Kevin Yank : Php and Mysql query

While we’re trying to understand this issue, what happend when you tell the php code to finish after echoing the first row?


while ($row = mysqli_fetch_array($result)) {
    var_dump($row);
    die();
}

What does the php error log show with the more recent code runs.

Also, what is the output_buffering set to in php.ini? If it’s on and a php error occurs, that can cause IE to show the “cannot display” error message.

$result = mysqli_query($link,‘SELECT id, joketext FROM joke’);

var_dump($result);
echo mysqli_error($link);
echo mysqli_num_rows($result);
while ($row = mysqli_fetch_array($result)) {
var_dump($row);
die();
}

once again… “Internet Explorer cannot display the webpage”

==================================================
This is the apache error log…
The error log shows :-
Sun Feb 28 00:47:12 2010] [notice] Parent: child process exited with status 255 – Restarting.
httpd.exe: Could not reliably determine the server’s fully qualified domain name, using 192.168.1.2 for ServerName
[Sun Feb 28 00:47:12 2010] [notice] Apache/2.2.14 (Win32) PHP/5.2.12 configured – resuming normal operations
[Sun Feb 28 00:47:12 2010] [notice] Server built: Sep 28 2009 22:41:08
[Sun Feb 28 00:47:12 2010] [notice] Parent: Created child process 1388
httpd.exe: Could not reliably determine the server’s fully qualified domain name, using 192.168.1.2 for ServerName
httpd.exe: Could not reliably determine the server’s fully qualified domain name, using 192.168.1.2 for ServerName
[Sun Feb 28 00:47:12 2010] [notice] Child 1388: Child process is running
[Sun Feb 28 00:47:12 2010] [notice] Child 1388: Acquired the start mutex.
[Sun Feb 28 00:47:12 2010] [notice] Child 1388: Starting 64 worker threads.
[Sun Feb 28 00:47:12 2010] [notice] Child 1388: Starting thread to listen on port 80.

Sorry - can see where to find the php error log…

in the php file :-
output_buffering = Off

To find your php error log, search the server the server for a file called php_error.log

It seems that the php request is crashing apache.

There seems to be a fix for this on window systems. Could you investigate updating libmysql.dll as mentioned in this post:
http://www.apachefriends.org/f/viewtopic.php?f=16&t=32617

[edit]Copying this file is also mentioned in the book’s errata page:

SpacePhoenix

I have searched all drives and cannot find this file anywhere…

pmw57

I tried the update (libmysql.dll) …no joy.

Thank you for Kevin’s update…

==================================================
p.12 Installing PHP
Although this book provides download and installation instructions for PHP 5.2, the newly-released (at the time of this writing) PHP 5.3 includes some new download options that aren’t covered in the book.

There are four different versions of PHP 5.3. for Windows: VC6 Non Thread Safe, VC6 Thread Safe, VC9 Non Thread Safe, and VC9 Thread Safe. Talk about confusing!

First of all, you definitely want a Thread Safe version of PHP. The Non Thread Safe versions are not suitable for use as a plugin for Apache.

Secondly, assuming you will install (or have already installed) a version of the Apache HTTP Server from httpd.apache.org (see page 13), you will need the VC6 version of PHP.

In short, to follow the instructions in this book, you need the VC6 Thread Safe version of PHP 5.3 for Windows.

the time here in blighty is approaching 2am. I’m shot. i need to get some sleep and i can’t face the thought of a new install at this time in the morning.
I really do need to get this stuff working because I’m committed to it for work reasons…

Thank you for this link.

I will download and install the latest versions tomorrow and see what happens…will def let you know…

Did you restart Apache after making the update?

ok - have some good news.
the good news is - at long last - i can delete a joke and pull more than a single column from mysql. Excellent !

I downloaded the lastest verion of php (5.3.1) and stuck it on my laptop
The laptop is running Vista and the system information tells me system type : 32-bit operating system.

pulled up my web browser and everything ran - just as it should.

The machine that I’ve been using up til now is a pc running 7. system info tells me that it’s a 64 bit operating system.

When I tried to install the new “working version” - (i.e. this mornings download that works on the laptop) on the pc - it had all sorts of problems and wouldn’t connect to mysql.

At this moment in time - I’m happy as I have a full working system on the laptop and I can crack on with my learning. Getting everything working on the pc can be next week’s problem.

Guys - a big thank you to everyone who has helped and advised. I’ve learnt alot about debugging and resolving issues.

…perhaps the old vista laptop ain’t so bad after all !