ich hab des jetzt nochmal mit mysqli versucht ... jedoch mit nem ähnlichen problem
Code:
<?php
$mysql = mysql_connect('localhost', 'root', 'diablo',false,65536);
mysql_select_db('test', $mysql);
$rs = mysql_query("call get_users('joey', @total);");
while($row = (mysql_fetch_assoc($rs)))
{
print_r($row);
echo '<br />';
}
mysql_close($mysql);
// now get the @total var
$rs2 = mysql_query("select @total;");
$total = mysql_fetch_assoc($rs2);
print_r($total);
echo "<br>Your Query: " . $rs2 . "<br>";
echo "Error: (" . mysql_errno() . ") " . mysql_error()."<br>";
$pdo = new PDO('mysql:dbname=test;host=127.0.0.1', 'root', 'diablo');
$data = $pdo->query("call get_users('joey', @totalUsers);")->fetchAll(PDO::FETCH_ASSOC);
$total_count = $pdo->query("select @totalUsers;")->fetchAll(PDO::FETCH_ASSOC);
print_r($data);
echo '<br />';
echo '-------------------------------------------------------------------------';
echo '-------------------------------------------------------------------------';
echo '<br>mysqli';
$mysqli = new mysqli('localhost', 'root', 'diablo', 'test');
print '<h3>MYSQLI: calling sp returning a recordset</h3>';
$rs2 = $mysqli->query("select @total;");
$total = mysql_fetch_assoc($rs2);
print_r($total);
?>
Code:
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, object given in /home/basti/public_html/sqlout.php on line 36
Lesezeichen