jkewlo Posted March 18, 2008 Share Posted March 18, 2008 <? $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? Quote Link to comment Share on other sites More sharing options...
Caberman Posted March 18, 2008 Share Posted March 18, 2008 Try: $sql="SELECT * FROM Books WHERE Description LIKE '%". $search ."%' ORDER BY Product_id Cheers. Quote Link to comment Share on other sites More sharing options...
jkewlo Posted March 18, 2008 Author Share Posted March 18, 2008 Thanks alot, What are the % % used for? Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted March 18, 2008 Share Posted March 18, 2008 those are wildcard symbols. it means 'and 0 or more other characters'. Quote Link to comment 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.