ee92 Posted February 10, 2009 Report Share Posted February 10, 2009 Hi, I've googled and searched through pages and tutorials to avoid bothering you guys with another question. But I've found nothing for this case. Can you please help? I have this code: <?php $pass = $_GET['pass']; $query="SELECT ID, Name, Description, Location, ListPrice, Price, Image FROM proclist WHERE ID = '$pass'"; $status=mysql_query($query) or die( "Query Failed."); $nt=mysql_fetch_array($status); ?> <?php $location = explode(",", "$nt[Location]"); $price = explode (",", "$nt[Price]"); $listprice = explode (",", "$nt[ListPrice]"); $count_values = sizeof($location); $loop_count=0; while ($loop_count < $count_values) { ?> <?php echo '' . $location[$loop_count] . '';?> Our Price: <?php echo $price[$loop_count];?> List Price: <?php echo $listprice[$loop_count]; $loop_count++; } echo $location[0]; ?> < <?php $pass = $_GET['pass']; $location = explode(",", "$nt[Location]"); echo $location[$pass]; mysql_close($link); ?> Every thing works except at the end of the code. "echo $location[$pass];" works when $pass is equal 1 or 2 (displays the correct value) but NOT when $pass is equal to 0 (does not display anything). Any ideas? Thank you. Quote Link to comment Share on other sites More sharing options...
sjhwebdesign Posted February 10, 2009 Report Share Posted February 10, 2009 $query="SELECT ID, Name, Description, Location, ListPrice, Price, Image FROM proclist WHERE ID = '$pass'"; asks your database to return results where the ID feild is equal to "pass", you can't have an id of zero if this is the primary key for the database, so there will be no results in your table that have an ID of zero so nothing will be displayed, same way for example there where 5 entries in your database and you set "pass" as 6 it would return nothing. 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.
Note: Your post will require moderator approval before it will be visible.