I have the following update:
$conn->query_cust("update cms_users set last_login_date = now() where id = " . $_SESSION['USER_INFO']->id);
I am sure that the problem is not in the query_cust function, because I use the same function in several 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:
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 bothers me is that it returns bool (true), but with (correct me if I'm wrong) is not a dangerous warning !? When I copy the update request manually, for example, PHPmyAdmin, it works (the user has the right to update / insert the table).
Just a little information for those who have the same problem: locally, the code runs without any problems (even with "error_reporting = E_ALL" turned on), but when executed in a test environment (Godaddy hosting), a warning appears.
PS: I'm not so in PHP (I'm from the JAVA world), so please have mercy by sending your answers and my stupid questions. Thanks.