I have the following update:
$conn->query_cust("update cms_users set last_login_date = now() where id = " . $_SESSION['USER_INFO']->id);
I’m sure the problem is not in the query_cust function because I use the same function in a few other forms and they work well. Anyway, here is the definition (with two var_dumps for debug-info):
function query_cust($s='',$rows=false,$organize=true) {
var_dump($s);
if (!$q=mysql_query($s,$this->con)) return false;
if ($rows!==false) $rows = intval($rows);
$rez=array(); $count=0;
$type = $organize ? MYSQL_NUM : MYSQL_ASSOC;
var_dump($q);
while (($rows===false || $count<$rows) && $line=mysql_fetch_array($q,$type)) {
if ($organize) {
foreach ($line as $field_id => $value) {
$table = mysql_field_table($q, $field_id);
if ($table==='') $table=0;
$field = mysql_field_name($q,$field_id);
$rez[$count][$table][$field]=$value;
}
} else {
$rez[$count] = $line;
}
++$count;
}
if (!mysql_free_result($q)) return false;
return $rez;
}
When executed, I get a Warning message saying:
string(57) "update cms_users set last_login_date = now() where id = 1" bool(true)
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/content/XX/XXXXXXX/html/core/mysql.php on line 26
What worries me is that it returns bool(true) but with (correct me if I’m wrong) a not ignorable warning !? When I copy the update-query manually into for example PHPmyAdmin it works (the user has table update/insert rights).
Just a few info for anyone having the same problem: Locally the code run’s without any problems (even with ‘error_reporting = E_ALL’ enabled), but when executed on the test environment (Godaddy’s hosting) the warning shows up.
PS: I’m not so into PHP (I’m from JAVA world) so please have mercy while posting your answers and my stupid sub-questions 🙂 Thanks.
Per the documentation,
mysql_queryreturnstrueif the query does not return a resultset. Change:to: