Jump to content


Photo

search result only returns 1 record


  • Please log in to reply
4 replies to this topic

#1 izzy

izzy
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 01 June 2006 - 11:52 AM

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



#2 samshel

samshel
  • Members
  • PipPipPip
  • Advanced Member
  • 837 posts

Posted 01 June 2006 - 11:54 AM

Please post code....
Cheers,
SamShel
-----------------------------------------------
--: FUTURE IS LINUX :--
-----------------------------------------------

#3 izzy

izzy
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 01 June 2006 - 11:57 AM

[!--quoteo(post=379033:date=Jun 1 2006, 01:54 PM:name=samshel)--][div class=\'quotetop\']QUOTE(samshel @ Jun 1 2006, 01:54 PM) View Post[/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>
<?php

mysql_close
?>

#4 samshel

samshel
  • Members
  • PipPipPip
  • Advanced Member
  • 837 posts

Posted 01 June 2006 - 12:26 PM

$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>
<?php

mysql_close
?>

Cheers,
SamShel
-----------------------------------------------
--: FUTURE IS LINUX :--
-----------------------------------------------

#5 izzy

izzy
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 01 June 2006 - 02:41 PM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users