izzy Posted June 1, 2006 Share Posted June 1, 2006 Hi,I have built a search part for my site, but this only returns one record where more than one should appear.Kan anyone tell me what i should do or what part of my script i should look at?greetz,Izzy Quote Link to comment https://forums.phpfreaks.com/topic/10947-search-result-only-returns-1-record/ Share on other sites More sharing options...
samshel Posted June 1, 2006 Share Posted June 1, 2006 Please post code.... Quote Link to comment https://forums.phpfreaks.com/topic/10947-search-result-only-returns-1-record/#findComment-40877 Share on other sites More sharing options...
izzy Posted June 1, 2006 Author Share Posted June 1, 2006 [!--quoteo(post=379033:date=Jun 1 2006, 01:54 PM:name=samshel)--][div class=\'quotetop\']QUOTE(samshel @ Jun 1 2006, 01:54 PM) [snapback]379033[/snapback][/div][div class=\'quotemain\'][!--quotec--]Please post code....[/quote]Here it the code...$search_SQL="SELECT * FROM huis WHERE naam LIKE '%".$_POST['searchall']."%' ORDER BY naam" or die("kan geen gegevens vinden");$search_result=mysql_query($search_SQL);$result=mysql_fetch_array($search_result);//afbeelding voorbereiden$img="";if($result['fotopath']) $img="<img width=150 height=150 src='../afbeeldingen/" . $result['fotopath'] . "'>";?><table width="410" border="0"> <tr> <span><strong><?php echo $result['naam']?></strong></span> <td width="350"> <table width="210" border="0"><tr> <td width="100">prijs: </td> <td> <span><?php echo $result['prijs']?></span> </td></tr><tr> <td>regio: </td> <td> <span><?php echo $result['regio']?></span> </td></tr><tr> <td>plaats: </td> <td> <span><?php echo $result['plaats']?></span> </td></tr><tr> <td>Opp. huis: </td> <td> <span><?php echo $result['opphuis']?></span> </td></tr><tr> <td>Opp. perceel: </td> <td> <span><?php echo $result['oppperceel']?></span> </td></tr><tr> <td>inhoud: </td> <td> <span><?php echo $result['inhoud']?></span> </td></tr><tr> <td>omschr.: </td> <td> <span><?php echo $result['omschr']?></span> </td></tr></table> <td width="200"> <span><?php echo $img?></span> </td></table><p><p></p></p><?phpmysql_close?> Quote Link to comment https://forums.phpfreaks.com/topic/10947-search-result-only-returns-1-record/#findComment-40878 Share on other sites More sharing options...
samshel Posted June 1, 2006 Share Posted June 1, 2006 [code] $search_SQL="SELECT * FROM huis WHERE naam LIKE '%".$_POST['searchall']."%' ORDER BY naam" or die("kan geen gegevens vinden");$search_result=mysql_query($search_SQL);//afbeelding voorbereiden?><table width="410" border="0"><?php while ($result=mysql_fetch_array($search_result)) {$img="";if($result['fotopath']) $img="<img width=150 height=150 src='../afbeeldingen/" . $result['fotopath'] . "'>";?><tr><span><strong><?php echo $result['naam']?></strong></span><td width="350"><table width="210" border="0"><tr><td width="100">prijs: </td><td><span><?php echo $result['prijs']?></span></td></tr><tr><td>regio: </td><td><span><?php echo $result['regio']?></span></td></tr><tr><td>plaats: </td><td><span><?php echo $result['plaats']?></span></td></tr><tr><td>Opp. huis: </td><td><span><?php echo $result['opphuis']?></span></td></tr><tr><td>Opp. perceel: </td><td><span><?php echo $result['oppperceel']?></span></td></tr><tr><td>inhoud: </td><td><span><?php echo $result['inhoud']?></span></td></tr><tr><td>omschr.: </td><td><span><?php echo $result['omschr']?></span></td></tr></table><td width="200"><span><?php echo $img?></span></td></tr><?php }?></table><p><p></p></p><?phpmysql_close?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/10947-search-result-only-returns-1-record/#findComment-40886 Share on other sites More sharing options...
izzy Posted June 1, 2006 Author Share Posted June 1, 2006 Thanks alot!!!It works.except for the layout of the table.This changes after the first record.but at least i'm getting all the records that i asked for. Quote Link to comment https://forums.phpfreaks.com/topic/10947-search-result-only-returns-1-record/#findComment-40918 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.