: Capturing a variable from a clicked link or url using php I've build a php page called pageById.php that pulls in and displays data from a MySQL database, but the query is 'static'. $sql
I've build a php page called pageById.php that pulls in and displays data from a MySQL database, but the query is 'static'.
$sql = "SELECT * FROM table WHERE id = 879";
I want to change this so it uses a variable in-place of 879.
$sql = "SELECT * FROM table WHERE id = $var";
I'd like to be able to pull the $var from a link on the previous page or from the URL, but I'm not sure how.
Can someone please help or point me in the direction of a decent tutorial for beginners?
Thanks!
More posts by @Becky754
1 Comments
Sorted by latest first Latest Oldest Best
You need to learn about GET and POST variables.
This is really basic PHP stuff :P
Have a look at php.net/manual/en/reserved.variables.post.php
This question is likely to be migrated to Stack Overflow where I am almost certain it will be a duplicate question
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.