Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP mySQL query won't run

Status
Not open for further replies.

scottmitchell

Programmer
Sep 7, 2002
11
US
Hey...

I'm learning PHP script and created a test php file. Have successfully created a database, inserted a table and a record. Now I'm trying to query the database and the query is failing to run (I'm receiving the output from my failure message..."could not query $table").

Here is the code:

$table = "members";
$username = "jsmitchell";
$password = "jm6ga00;";
$membername = "Jeremy Mitchell";

$query = "select from '$table' where username='$username'";
$result = mysql_query($query);

if(! $result)
{
print "Could not query $table";
};

Is there something wrong with this query statement?
Any help would be most appreciated!

Thanks,

Scott M.
 
Your query doesn't specify what columns you want to select. Try changing
Code:
$query = "select from '$table' where username='$username'";
to
Code:
$query = "select * from '$table' where username='$username'";
to select all the columns. //Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top