I have used mysql_fetch_row in other places in the application where it works as expected, but in one function it is NOT returning the value in field[0]. This is a snippet of the code with my test lines:
$stmnt = "SELECT COUNT(*) FROM Sessions " .
"WHERE SessionID = " . $this->fieldnullquote($session_id);
$result = mysql_query($stmnt, $this->link);
$row = mysql_fetch_row($result);
print_r($stmnt . "<br>");
print_r($result . "<br>");
print_r($row . "<br>");
print_r(mysql_field_name($result, 0) . "<br>");
print_r(mysql_num_fields($result) . "<br>");
print_r(mysql_num_rows($result) . "<br>");
print_r($row[0] . "<br>");exit;
And here are the results:
SELECT COUNT(*) FROM Sessions WHERE SessionID = '41922549952d2ffe8916d08.43055088'
Resource id #9
Array
COUNT(*)
1
1
$row[0] should return a value of 1 as the query does in phpMyAdmin and as is shown by the results of
print_r(mysql_num_rows($result) . "<br>");
I know mysql_fetch_row will be deprecated, however it is working else where in the application.
Probably the error is too obvious for me to see...been looking at this for a LONG time.
Baffled,
Todd