1
I make an appointment at DB
mysql
and it works normal, then I’m going to do the second consultation and you give me the following mistake:
Warning: mysql_fetch_object(): supplied argument is not a Valid Mysql result Resource in C: xampp htdocs
Follow the PHP code below:
<php>
$open = new OpenDB();
$open->conectarNovamente($_SESSION['usuario'], $_SESSION['senha']);
$hoje = date('Y-m-d');
$sql = "call proc_rel_controle_diario(NOW(),0,0)"; // ADD 1 dia
$r = mysql_query($sql);
$obj = mysql_fetch_object($r);
$dia1 = $obj->total_geral;
$sql = "call proc_rel_controle_diario(NOW() + INTERVAL 1 DAY,0,0)"; // ADD 1 dia
$r = mysql_query($sql);
$obj = mysql_fetch_object($r);
$dia2 = $obj->total_geral;
mysql Workbench works the same way and works both ways, only in php.
– SneepS NinjA
The problem is that the mysql_* functions do not work properly with stored procedures the recommended is you replace them with mysqli or Pdo. why we should not use the mysql functions_*
– rray
I always used mysql_* in Precedent, I never had problems, even so I used the mysqli_* recommendation and gave another error
Warning: mysqli_fetch_object() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs
– SneepS NinjA
On the lines you have
mysql($sql)
, leave so to display the error:$r = mysql_query($sql) or die(mysql_error());
and put the error message.– rray