|
Posted by John Swartzentruber on 10/04/95 11:10
I am running Fedora core3 with Apache 2.0.52 (from default RPMs), MySQL
4.1.10 (from RPMs from MySQL site), and PHP 5.0.3 built from source.
I'm going through the PHP manual and trying some of the mysqli examples.
The last one I tried didn't work. The problem appears to be this line:
$row = $result->fetch_array(MYSQLI_ASSOC);
Using MYSQLI_BOTH also fails, and MYSQLI_NUM works.
This is what is in my httpd error log:
[Thu Mar 10 17:07:06 2005] [error] jk2_init() Can't find child 29980 in
scoreboard
[Thu Mar 10 17:07:06 2005] [notice] workerEnv.init() ok
/etc/httpd/conf/workers2.properties
[Thu Mar 10 17:07:06 2005] [error] mod_jk child init 1 -2
[Thu Mar 10 17:07:06 2005] [notice] child pid 29903 exit signal
Segmentation fault (11)
As I said, removing the second fetch_array() call allows the script to run.
Here is the entire script:
<?php
include "../../secrets/rootmysqlpass.inc.php"; // only defines $rootpass
$mysqli = new mysqli("localhost", "root", $rootpass, "World");
echo "<pre>";
printf("Host information: %s\n", $mysqli->host_info);
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, CountryCode FROM City ORDER by ID LIMIT 3";
$result = $mysqli->query($query);
/* numeric array */
$row = $result->fetch_array(MYSQLI_NUM);
printf ("%s (%s)\n", $row[0], $row[1]);
/* associative array */
$row = $result->fetch_array(MYSQLI_ASSOC);
printf ("%s (%s)\n", $row["Name"], $row["CountryCode"]);
/* free result set */
$result->close();
$mysqli->close();
echo "</pre>";
?>
[Back to original message]
|