Jump to content

extracting data from table


Recommended Posts

$con = mysql_connect("localhost","my_username","my_pass");if (!$con)  {  die('Could not connect: ' . mysql_error());  }mysql_select_db("my_db", $con);$queryy = 'SELECT * FROM ' . $_Get['table']; $resultt = mysql_query($queryy);$roww = mysql_fetch_array($resultt); $Name= $roww[1];

Basically I have a form where a person selects from what table the data will be extract fromBut for some reason the code above shows error

$queryy = 'SELECT * FROM ' . $_Get['table'];

Link to comment
Share on other sites

GET is in capitals -

$queryy = 'SELECT * FROM ' . $_GET['table'];

You should also use mysql_real_escape_string() on the variable.

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

  • Create New...