My first PHP and SQL project, and I'm getting the error in the post title. Google isn't helping, or I'm just not understanding whats' come up. Not sure which. Didn't find anything relevant here(or didn't understand the relevance- feel free to point me to an existing thread if it will help).
Anyways, in the code below, I'm getting the no such field error. I've checked the database and the table does exist, and "select *" should mean I don't have to worry about the column name. The echo of my user and pass shows that this script is getting the correct data(I get the same result when deliberately sending invalid data).
My 'echo "In error\n"' does display, but the "made query" one a couple lines down does not.
I have no idea if this is a PHP or SQL problem. Apache logs show no problem, I'm not sure where my MySQL error log got put. I'm using OS X Snow Leopard, the SQL log instructions I found don't seem to match up with what I have installed so I'm a little lost on where to find it. I suspect it would be enlightening to this(and certainly other) problems, so any pointers on how to get to that log would be much appreciated.
I'm probably missing something really small and embarassingly obvious, and again, if there is an existing thread that answers my question feel free to point the way in lieu of a full answer in this one, and my apologies for not finding it on my own.
<!-- Check login information, if good load admin panel if bad reload login -->
<html><head><title>Hello</title></head><body>
<?php
//Connect to database
require_once('DB.php');
$db = DB::connect("mysql://excessive:paranoia@localhost/database");
if(DB::iserror($db)){
die($db->getMessage());
}
echo $POST['user'] . ' ' . $POST['pass'];
//Check database for this user/pass combo
$sql = "SELECT *
FROM user_info
WHERE login_name =" . $POST['user'] . " AND password = " . $POST['pass'];
$q = $db->query($sql);
if(DB::iserror($q)){
echo "In error\n";
die($q->getMessage());
}
echo "Made query";
?>
</body>
</html>