Re: Returns Blank

From: Date: Thu, 20 Jan 2005 22:05:18 +0000
Subject: Re: Returns Blank
References: 1 2 3 4  Groups: php.db 
Request: Send a blank email to php-db+get-38248@lists.php.net to get a copy of this message
Squeakypants ha scritto:
From a forum that recommended this to me, I changed the query execution to this: $query = "SELECT credits FROM krypto WHERE user=$user AND pass=$pass"; echo "query = ". $query ."\n"; $result = mysql_query($query); echo "result = ". $result ."\n"; So now it outputs this: query = SELECT credits FROM krypto WHERE user=admin AND pass=xxxxxxxx result = Could not run query: Unknown column 'admin' in 'where clause'
Your query is missing quotes near the values for the attributes user ad pass, so mysql try to compare the value user to some value inside an ipotetic admin field Try this: $query = "SELECT credits FROM krypto WHERE user=\"$user\" AND pass=\"$pass\""; Bye

« previous php.db (#38248) next »