Hi All,
I'm pretty new but hacking my way through, have a problem, wondering if you guys can help. I've had this problem a few times now.
Data is displayed in a table allowing a user to click on a link/URL to drill down on more data, so the URL is dynamic for whatever row of data your on, for example:
http://domain.com/file.php?id=11
When file.php is run, the value of $id is not 11 it is something else????? This is my problem. I check both of my php files, the one that displays the data and passes the variable and the other that is meant to take the variable and perform a query with it and they both show $id with some other number and I have no idea where it comes from?
I have lots of print $id; statements throughout my pages to tell me what value it is and it appears to be already set to something else and I am unable to pass the value?
What am I doing wrong?????????
Thanks, Digs.
:Here is my code that queries the data, displays the table and passes the $id value. It works no problem, however, at the begining of this page $id is already set to some other number? And when file.php?id=10 is opened up $id is something else, like 9!!!!!!!!
// display list from insurance
$url_text = "http://www.domain.com/file.php";
$sql = "SELECT * FROM insurance";
$result = mysql_query($sql);
printf("<table border=1 CELLSPACING=0 CELLPADDING=0>");
while ($myrow = mysql_fetch_array($result))
{
printf("<tr>");
printf("<td>%s</td>\n",$myrow["age"]);
printf("<td>%s</td>\n",$myrow["license_level"]);
printf("<td>%s</td>\n",$myrow["years_licensed"]);
printf("<td>%s</td>\n",$myrow["location"]);
printf("<td>%s</td>\n",$myrow["driving_record"]);
printf("<td>%s</td>\n",$myrow["bike_make"]);
printf("<td>%s</td>\n",$myrow["bike_model"]);
printf("<td>%s</td>\n",$myrow["bike_plate"]);
printf("<td>%s</td>\n",$myrow["insurance_company"]);
printf("<td>%s</td>\n",$myrow["insurance_period"]);
printf("<td>%s</td>\n",$myrow["premium"]);
printf("<td>%s</td>\n",$myrow["multiple_vehicles"]);
printf("<td>%s</td>\n",$myrow["insurance_type"]);
printf("<td><a href=\"%s?id=%s\">%s</a></td>\n",$url_text,$myrow["id"], $myrow["problems"]);
printf("<td>%s</td>\n",$myrow["rating"]);
printf("<td>%s</td>\n",$myrow["recommend"]);
printf("</tr>");
}
printf("</table>");