I am reading a php/mysql book and came across link code <a href="?string… > that the target string begins with a question mark (below). Can someone explain how this is used to provide a link to a php variable using database info.
?category_id is the same as saying index.php?category_id=…, it’ll take whatever page you’re on and put it infront of the question mark.
the data for $category[‘categoryID’] is being pulled from either an array somewhere else or from a query, using $category as the variable. I don’t know the specific usage that you’re trying to do, but it might look like
[php]
$cat = mysql_query(“SELECT categoryID FROM table”);
while($category = mysql_fetch_array($cat)) { ?>
[/php]
Thanks,
I understand the last paragraph, pulling data from an array. It was the 2nd paragraph, putting a question mark before the variable that I had never seen before.
?category_id is the same as saying index.php?category_id=…, it’ll take whatever page you’re on and put it infront of the question mark.
Basically, are you saying that this link with the ?category_id, keeps you on the same page when clicking it, rather than taking you to another page?
yep, there’s code on that page that takes the link and does something with it
Thanks, great information.