izzy Posted May 23, 2006 Share Posted May 23, 2006 Hi,I am making a search function for my site which now is being built in php5.(I think) I'm doing something wrong in the script for the search results searchresult.php.I've lookt all over the NET to find my answer but i just don't get it.Can someone please help me solve my problem and explain what i am doing wrong.Here are my wonderfull creations...[b]This is the script for the search form[/b]<form action="searchresults.php" method="post"> <table> <tr> <td width="120">Search:</td> <td> <input type="text" name="searchall" size="45"> </td> </tr> <tr> <td> <input type="hidden" name="searchresults" value="searchresults.php"> <input type="submit" name="submit" value="search" </td> </tr> <table></form>[b]This is the script for searchresults.php[/b]//Een verbinding met de database makeninclude("../systeem/connect.inc.php");$search_SQL="SELECT * FROM huis WHERE searchall LIKE '%searchresults%' 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='../planeshop/catalogus/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/10250-need-help-with-my-search-funtion/ Share on other sites More sharing options...
samshel Posted May 23, 2006 Share Posted May 23, 2006 Change your query to :$search_SQL="SELECT * FROM huis WHERE searchall LIKE '%".$_POST['searchresults']."%' ORDER BY naam" or die("kan geen gegevens vinden");hth Quote Link to comment https://forums.phpfreaks.com/topic/10250-need-help-with-my-search-funtion/#findComment-38186 Share on other sites More sharing options...
izzy Posted May 23, 2006 Author Share Posted May 23, 2006 I did and this appears.this message is the same as what i got before.Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Program Files\xampp\htdocs\makelaar\search\searchresults.php on line 8 prijs: regio: plaats: Opp. huis: Opp. perceel: inhoud: omschr.: Quote Link to comment https://forums.phpfreaks.com/topic/10250-need-help-with-my-search-funtion/#findComment-38190 Share on other sites More sharing options...
izzy Posted May 23, 2006 Author Share Posted May 23, 2006 Ive got it!!!Igot my database field and my $_POST field mixed up.I swithed them and voila... it works.Somehow you got me lokking in the right direction.THANX Quote Link to comment https://forums.phpfreaks.com/topic/10250-need-help-with-my-search-funtion/#findComment-38193 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.