Jump to content

SQL command knowhow issue

Recommended Posts

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.....





I don't know how to do this can anyone help me?

  • Like 1
Link to post
Share on other sites

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...



Thanks for the help, but now the $_GET command is not working too. This is what I have so far,

// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
$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 by JJ_ceo
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...