Re: Returns Blank

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Squeakypants wrote:
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'


Quotes are your friend. admin is a string, not a field. Also, it's not bad practice to backtick the database fields themselves.

$query = "SELECT credits FROM krypto WHERE `user`='$user' AND `pass`='$pass'";

You'll want to try to read your error messages a little harder in the future, FWIW.

Cheers,
--
- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital.


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux