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>"; ?>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php