harkly Posted November 20, 2008 Share Posted November 20, 2008 Not really sure how to go about this question. I am getting an error when pulling id's for a certain page of mine. Most of the time it works and other times it pulls a bunch of information. Upon researching the problem it seems to pull a list on names if the ID its pulling starts at the low end, example ... if I ask for AR1000, then that is the only info it gives me but if I ask for AR100 then I get a bunch more - AR1001, AR1002 etc. My question is shouls all my primary IDs be the exact same number lenght? Should AR100 be AR0100? This is my code but I don't think the issue is there. $search=$_GET["artid"]; echo "<table width=950 border=0 align=center>"; echo " <tr>"; echo " <td width=200>";echo " </td>"; echo " <td width=600>"; //pulls info for Artist $result = mysql_query("SELECT * FROM artist WHERE artid LIKE '%$search%'"); while ($r=mysql_fetch_array($result)) { $fullName=$r["fullName"]; $dob=$r["dob"]; $dod=$r["dod"]; $nationality =$r["nationality"]; $choosen_medium=$r["artForm"]; $artid=$r["artid"]; //display the row echo " <img src=\"image/artist/$artid.jpg\" border=0> ".$fullName.", ".$dob."-".$dod." <br><br>"; } Link to comment https://forums.phpfreaks.com/topic/133543-solved-database-question/ Share on other sites More sharing options...
Mchl Posted November 20, 2008 Share Posted November 20, 2008 Change your query $result = mysql_query("SELECT * FROM artist WHERE artid LIKE '%$search%'") to $result = mysql_query("SELECT * FROM artist WHERE artid = '$search'") The first one is getting anything that is similar (LIKE) to your search criteria. Link to comment https://forums.phpfreaks.com/topic/133543-solved-database-question/#findComment-694627 Share on other sites More sharing options...
harkly Posted November 20, 2008 Author Share Posted November 20, 2008 Thanks! I was so worried that I would have to modify my db. Link to comment https://forums.phpfreaks.com/topic/133543-solved-database-question/#findComment-694632 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.