Jump to content

Recommended Posts

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 maken
include("../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>
<?php

mysql_close
?>
Link to comment
https://forums.phpfreaks.com/topic/10250-need-help-with-my-search-funtion/
Share on other sites

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.:

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.