Hi guys, can anyone show me the query i need to include to extract info from a table in a database by using the ID in the table as the target.
I am used to getting info from this:
mysql_connect ("host", "database", "user", "pass") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("database");
$query = "SELECT info1, info2, info3 FROM "tablename" ORDER BY id";
$tablename = mysql_query($query) or die ("Query failed");
while ($tablenames = mysql_fetch_array($tablename))
The info is pulled into a table on my site and lists every entry in the table, however, is there a way i can just pull out one entry by it's ID.
Please be gentle as I'm completely new
[SOLVED] extracting all info from an ID in a table
Moderator: General Moderators
Using the WHERE clause...
Code: Select all
$query = "SELECT info1, info2, info3 FROM 'tablename' where id = '1'";