Jump to content

Search Database No Results


jkewlo

Recommended Posts

<?
	$search = $_REQUEST["search"];
	$lim = 10;
	$rowsPerPage = 13;

$conn = new COM('ADODB.Connection') or die('Could not make conn');
$rs = new COM('ADODB.Recordset') or die('Coult not make rs');

$connstring = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\\wamp\\www\\pro\\project\\Rainwater.mdb";

$conn->Open($connstring);
if (!$conn)
  {exit("Connection Failed: " . $conn);}
$sql="SELECT * 
FROM Books 
WHERE Description = '". $search ."'
ORDER BY Product_id 
";
$rs->Open($sql, $conn);

while(!$rs->EOF) {

echo" <table width=702 border=0 cellpadding=0 cellspacing=0>
  <!--DWLayoutTable-->
  <tr>
    <td width=97 height=38 valign=top>You Searched for:</td>";
echo" <td colspan=4 valign=top>".$url."</td>";
echo" <td width=200></td>
  </tr>
  <tr>
    <td height=38 valign=top>Book Cover</td>
    <td width=77 valign=top>Product Id</td>
    <td width=105 valign=top>Catergory</td>
    <td width=84 valign=top>Title</td>
    <td width=139 valign=top>Author</td>
    <td valign=top><a href=viewmore.php?id=".$rs->Fields['Product_id'].">View More</a></td>
  </tr>
  <tr>";
echo" <td height=24 valign=top><img src=Pic/". $rs->Fields['Big'] ."></td>";
echo" <td valign=top>".$rs->Fields['Product_id']."</td>";
echo" <td valign=top>".$rs->Fields['Catergory']."</td>";
echo" <td valign=top>".$rs->Fields['Title']."</td>";
echo" <td valign=top>Rar".$rs->Fields['Author']."</td>";
echo" <td></td>
  </tr>
</table>";
$rs->MoveNext();
}


$rs->Close();

$conn->Close();

$rs=null;
$conn=null;
	?>

 

its all working ok but it wont display any search results.

 

just blank wont display the tables either which is understandable because they are being called only to show when there is data to be displayed which there is plenty of it in the database.

 

so if the user wanted to search for Flexible it will search the database in the Description field for Flexible and the magic will happen, any clue on why nothing is being displayed?

Link to comment
Share on other sites

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.