Code Comments
Programming Forum and web based access to our favorite programming groups.MySQL version 5.0.3
PHP version 5.0.4
Apache version 2.0.5
Source:
<?php
$mysqli = new mysqli("localhost", "user", "pass", "dbname");
$body = '';
/* // ver 1
$query = '
CREATE TEMPORARY TABLE IF NOT EXISTS proba(id INT UNSIGNED);
INSERT INTO proba VALUES (213), (7), (87);
';
$mysqli->multi_query($query);
*/
/* // ver 2
$query = 'CREATE TEMPORARY TABLE IF NOT EXISTS proba(id INT UNSIGNED);';
$mysqli->query($query);
$query = 'INSERT INTO proba VALUES (213), (7), (87);';
$mysqli->query($query);
*/
//control
$query = 'select * from proba;';
$result = $mysqli->query($query);
$body .= '<strong>Table proba:</strong><br>';
if ($result) {
while ($row = $result->fetch_row()) {
$body .= $row[0].'<br>';
}
$result->close();
}
else $body .=
'<strong>Error</strong>:'.$mysqli->errno.'<br>'.$mysqli->error.'<br><br>';
$query = 'DROP TABLE IF EXISTS proba;';
$result = $mysqli->query($query);
echo $body;
$mysqli->close();
?>
In short, ver 1 doesn't work, control output 2006: MySQL server has gone
away. Ver 2 works!
Question is why?
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.