JJ_ceo 1 Posted April 22, 2014 Report Share Posted April 22, 2014 Ok so I have been looking for how to do this all day(Very long time) and I can't find it anywhere. What I am trying to do is power my website with what I call URL variables the things that YouTube uses E.G. Page.php?video=1 but when it comes to selecting data from my database I have an issue. I have a table for ID and some others I will call them EX1 to EX5, what I am trying to do is the URL "?" thing says a number and that number is turned into a variable(don't know how) but that variable indicates the ID, but I don't want to put the ID on the page, I want the ID to tell my PHP code where in the tables the EX1 - EX5 are, so they can become a variable for later use on the page. Sum up. PHP takes the URL?name=1 turns into variable(1) - variable indicates where in the columns to look LOOKS UNDER ID finds 1 - now it needs to make the EX1 - EX5 in the same column into variables. ID EX1 EX2..... 1 I don't know how to do this can anyone help me? 1 Quote Link to post Share on other sites
davej 251 Posted April 22, 2014 Report Share Posted April 22, 2014 You generally have a page which receives a form and then uses $_GET to access the values. It may be a page that sends a form to itself. See... http://www.php.net/manual/en/reserved.variables.get.php Quote Link to post Share on other sites
JJ_ceo 1 Posted April 28, 2014 Author Report Share Posted April 28, 2014 (edited) You generally have a page which receives a form and then uses $_GET to access the values. It may be a page that sends a form to itself. See... http://www.php.net/manual/en/reserved.variables.get.php Thanks for the help, but now the $_GET command is not working too. This is what I have so far, <?php $con=mysqli_connect("host","username_table.access.name","Password","username_table.name"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } //This Part HERE IS NOT WORKING! $result = mysqli_query($con,"SELECT * FROM games WHERE id='$_GET["id"]'"); // / The part above is not working. while($row = mysqli_fetch_array($result)) $name = $row['name']; $price = $row['price']; $sdes = $row['short_des']; $ldes = $row['long_des']; $img = $row['img']; $img1 = $row['eximg1']; $img2 = $row['eximg2']; $img3 = $row['eximg3']; $img4 = $row['eximg4']; $video = $row['video']; ?> Edited April 28, 2014 by JJ_ceo Quote Link to post Share on other sites
JJ_ceo 1 Posted April 28, 2014 Author Report Share Posted April 28, 2014 It's Working NOW!! I was just looking and I forgot a curly bracket. Quote Link to post Share on other sites
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.