473,325 Members | 2,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Can help to check and correct my search engine code?

This is the search engine code that i create, but it was error and didnt come out the result. Cn u help me to check what wrong with my code?
Thanks

<Table cellspacing=1 cellPadding=1 align=center>
<td colspan=4>
<h2 align=center>Bomba inventory searching system</h2>
<tr>
<td>
<h4 Balai Bomba Inventory Searching System</H4>
<form name="search" method="post" action="<?=$PHP_SELF?>">
Search for:
<br><input type="text" name="search">

<br><Select NAME="field">
<Option VALUE="Operasi">Operasi</option>
<Option VALUE="Balai">Balai</option>
<Option VALUE="Komunikasi">Komunikasi</option>
</select>

<br><input type="submit"name="Submit"value="Submit"/>

</form>

<?
//required file for database connection
require("config.php");
if (isset($_POST['search'])) {
$search = mysql_real_escape_string($_POST["search"]);
$field=mysql_real_escape_string($_POST["field"]);
echo "<h2>Results</h2><p>";

//If they did not enter a search term we give them an error
if ($search== "") {
echo "<p>You forgot to enter a search term";
}

//Now we search for our search term, in the field the user specified
$data ="SELECT * FROM listofitem ";
if($field=='Operasi'){
$data .="AND listofitem.NamaPeralatan LIKE'%search%'";}

elseif($field=='Balai'){
$data .="AND listofitem.NamaPeralatan LIKE '%search%'";}

elseif($field=='Komunikasi'){
$data .="AND listofitem.NamaPeralatan LIKE'%search%'";}

$result=mysql_query($data);


//echo "<tr><td bgcolor='#CCCCFF'>ID</th><td bgcolor='#CCCCFF'>NamaPeralatan</th><td bgcolor='#CCCCFF'>Jenama</td> </tr>";
//And we display the results
if($result && (mysql_num_rows($result))>0){
while($row = mysql_fetch_assoc( $result )){
echo "<tr><td><a href='InformationPage.php?id={$row['ID']}'>{$result['ID']}</a></td>
<td><a href='InformationPage.php?id={$row['NamaPeralatan']}'>{$result['NamaPeralatan']} </td>
<td>{$row['Jenama']}</td>
</tr>";
echo" <b>Searched For:</b> " .$search;
}
}
//This counts the number or results - and if there wasn't any it gives them a little message explaining that
$anymatches=mysql_num_rows($result);
if ($anymatches == 0)
{
echo "Sorry, but we can not find an entry to match your query<br><br>";
}
}
//And we remind them what they searched for


?>

<a href='AddNew(operasi).php?id=Search Again'>AddNew(Operasi)</a>
<a href='AddNew(Balai).php?id=Search Again'>AddNew(Balai)</a>
<a href='AddNew(Komunikasi).php?id=Search Again'>AddNew(Komunikasi)</a>
Oct 7 '06 #1
3 2192
ronverdonk
4,258 Expert 4TB
Firstly, it would be nice to your co members to display your approx 70 lines of code within code or php tags.
Secondly
but it was error and didnt come out the result. Cn u help me to check what wrong with my code?
is not really giving any information on:
  • what the error was
  • what you have done to track the error (like echo traces)
  • how far in the code everything is still working as expected
Please provide the members that information.

Ronald :cool:
Oct 7 '06 #2
Firstly, it would be nice to your co members to display your approx 70 lines of code within code or php tags.
Secondly
is not really giving any information on:
  • what the error was
  • what you have done to track the error (like echo traces)
  • how far in the code everything is still working as expected
Please provide the members that information.

Ronald :cool:
my error is what ever the keyword i insert into ,it still come out with the same result even i option in field is different . The selection there seen ike did not function alt all. can u check for me?
Oct 9 '06 #3
ronverdonk
4,258 Expert 4TB
my error is what ever the keyword i insert into ,it still come out with the same result even i option in field is different . The selection there seen ike did not function alt all. can u check for me?
You have not answered the questions asked, you just keep on saying: "It does not work as expected". The questions were:
- what the error was, you answered that: "It does not work at all"
- what you have done to track the error (like echo traces)
- how far in the code everything is still working as expected

You have to do that before we go on chasing across your code.

Ronald :cool:
Oct 9 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: R. Rajesh Jeba Anbiah | last post by:
Q: Is PHP search engine friendly? Q: Will search engine spiders crawl my PHP pages? A: Spiders should crawl anything provided they're accessible. Since, nowadays most of the websites are been...
20
by: | last post by:
If I need to check if a certain value does exist in a field, and return either "yes" or "not" which query would be the most effestive?
5
by: George | last post by:
Hi, Anyone has the background for explaining? I have made a search on my name and I have got a link to another search engine. The link's title was the search phrase for the other search engine...
14
by: vic | last post by:
My manager wants me to develop a search program, that would work like they have it at edorado.com. She made up her requirements after having compared how search works at different websites, like...
2
by: jimi_xyz | last post by:
Sorry if this isn't the correct group, i don't think there is a group for straight HTML. I am trying to create a type of search engine. There are two radio buttons at the top, in the middle there...
7
by: Andy Mabbett | last post by:
I've just placed an "opensearch.xml" file on a website I mange. At present, it's only referenced from one page: http://www.westmidlandbirdclub.com/new.htm and the results are HTML, not RSS/...
3
by: Phaelle | last post by:
Dear all, I am doing a search engine, and I have a problem, I need to check which of the checkboxes has been checked. According to the checkbox checked, the search engine will search a specific...
1
by: zafar | last post by:
Hi, I want to make a personal digital library, For that I need make a search engine, User can search by giving the key words, but the spelling of given key word may be incorrect, so It is needed...
7
by: =?Utf-8?B?SklNLkgu?= | last post by:
How to get search engines crawl data I have a web application that uses user controls and pulls data directly from database and shows it to users in the internet. So there is not html that has the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.