Please help me to solve my problem. i want the search information to be display such as, currently it's not showing the title webzworks.com/web_project_2008/red/search.php Restaurant Name : Address : County : City : Suburb : I posted including with my coding.. pls help me <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <table width="616" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="616" height="359" valign="top"><h2>Search</h2> <form name="search" method="post" action="<?=$PHP_SELF?>"> Seach for: <input type="text" name="find" /> in <Select NAME="field"> <Option VALUE="fname">Name</option> <Option VALUE="faddress">Address</option> <Option VALUE="fcountry">Country</option> <Option VALUE="fcity">City</option> <Option VALUE="fsuburb">Suburb</option> </Select> <input type="hidden" name="searching" value="yes" /> <input type="submit" name="search" value="Search" /> </form> </td> </tr> </table> <? //This is only displayed if they have submitted the form if ($searching =="yes") { echo "<h2>Results</h2><p>"; //If they did not enter a search term we give them an error if ($find == "") { echo "<p>You forgot to enter a search term"; exit; } // Otherwise we connect to our Database mysql_connect("localhost", "webzwork_red", "58281044") or die(mysql_error()); mysql_select_db("webzwork_red") or die(mysql_error()); // We preform a bit of filtering $find = strtoupper($find); $find = strip_tags($find); $find = trim ($find); //Now we search for our search term, in the field the user specified $data = mysql_query("SELECT * FROM users WHERE upper($field) LIKE'%$find%'"); //And we display the results while($result = mysql_fetch_array( $data )) { echo $result['fname']; echo "<br>"; echo $result['faddress']; echo "<br>"; echo $result['fcountry']; echo "<br>"; echo $result['fcity']; echo "<br>"; echo $result['fsuburb']; echo "<br>"; echo "<br>"; } //This counts the number or results - and if there wasn't any it gives them a little message explaining that $anymatches=mysql_num_rows($data); 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 echo "<b>Searched For:</b> " .$find; } ?> </body> </html> Edit/Delete Message
maybe you can try to add/edit this : while($result = mysql_fetch_array( $data )) { echo "Restaurant name : " . $result['fname']; echo "<br>"; echo "Address : " . $result['faddress']; echo "<br>"; echo "Country : " . $result['fcountry']; echo "<br>"; echo "City : " . $result['fcity']; echo "<br>"; echo "Suburb : " . $result['fsuburb']; echo "<br>"; echo "<br>"; } hpoe it can help you.
you can use table to arrange it : while($result = mysql_fetch_array( $data )) { echo "<table><tr><td>"; echo "Restaurant name :</td><td>" . $result['fname']; echo "</td></tr>"; echo "<tr><td>Address :</td><td>" . $result['faddress']; echo "</td></tr>"; echo "<tr><td>Country :</td><td>" . $result['fcountry']; echo "</td></tr>"; echo "<tr><td>City :</td><td>" . $result['fcity']; echo "</td></tr>"; echo "<tr><td>Suburb :</td><td>" . $result['fsuburb']; echo "</td></tr></table>"; } hope it works, the point is use table, I can't try it but the basic is there