phpfanphp Posted August 26, 2007 Share Posted August 26, 2007 Any idea why the code below is returning: Search Results ".$fieldvalue." "; } echo " "; } ?> Click here to go bck to the search page. in Firefox and IE? <html> <head> <title>Vinyl Dealers: search results</title> </head> <body> <h2>Search Results</h2> <br> <?php $db = mysql_connect("localhost"); mysql_select_db("vinyldealers",$db); $query = "SELECT shops.name, shops.phone, shops.email, shops.website FROM shops WHERE name LIKE '%".$name."%'"; //% is a wilecard character. Will make the query find all inst. where $name is ...? $result = mysql_query($query); while ($record = mysql_fetch_assoc($result)) { while (list($fieldname,$fieldvalue) = each ($record)) { echo $fieldname.":<b>".$fieldvalue."</B><BR>"; } echo "<BR>"; } ?> <br> <a href'"searchbyname.html">Click here to go bck to the search page.</a> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/66771-code-question/ Share on other sites More sharing options...
Barand Posted August 26, 2007 Share Posted August 26, 2007 If I substitute my data it's fine, so maybe it's your data? try this and check data contents echo '<pre>'; while ($record = mysql_fetch_assoc($result)) { var_dump($record); } echo '<pre>'; Quote Link to comment https://forums.phpfreaks.com/topic/66771-code-question/#findComment-334588 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.