Page 2 of 2

Re: query works in phpmyadmin but not from my code

Posted: Sun Mar 28, 2010 5:50 pm
by Benjamin
Ok, I found the problem. I never use OR and didn't realize it could affect return values.

Change

Code: Select all

function SendQ($query)
{
  return mysql_query($query) or die(mysql_error());
}
To

Code: Select all

function SendQ($query) {
    $result = mysql_query($query);
    if (!$result) die(mysql_error());
    return $result;
}
[text]root@midnight:# php -r 'echo var_dump(4 OR false);'
bool(true)
[/text]

Re: query works in phpmyadmin but not from my code

Posted: Sun Mar 28, 2010 6:00 pm
by KrypticNinja
Thank you so much for all your help. I'm not sure I'd have ever figured that out, ha ha.