Jump to content

SQL command knowhow issue


JJ_ceo
 Share

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

1

 

 

 

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

  • Like 1
Link to comment
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...

 

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 by JJ_ceo
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...