Database Website - Php/Mysql - pg. 148 (SELECT id, joketext)

Hi,
I’m having trouble with the deleting a joke example, the adding example is working 100%.

I’m using the code archive to overcome any spelling mistakes (So it is exactly as it is in the book)

When i run the complete site, i get an error saying the page is not available
(In Chrome on Windows, i get this error: Error 324, net::ERR_EMPTY_RESPONSE): Unknown error.)

When i change the section that fetches the jokes to:

$result = mysqli_query($link, ‘SELECT joketext FROM joke’); (As in Add joke example)

It runs the site but obviously its not parsing an ID so it doesnt work.

As soon as i add the id in:
$result = mysqli_query($link, ‘SELECT id, joketext FROM joke’);
I get the error,

Anyone getting the same result?
Any advice please?

Welcome to the forums fbrill,

This member is having a similar if not the same problem

Please read http://www.sitepoint.com/forums/showpost.php?p=4331363&postcount=12 Thanks.

I’m having EXACTLY the same problem when trying to run the DELETEJOKE example. I have tried other examples and always when SELECTING more than one field, I get the same error message.

When I edit the ADDJOKE example and change the SELECT statement to

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

I get the same error. The problem seems to occur when selecting more than 1 field from the database.

Any ideas?

Hi mcderllo, welcome to the forums,

Did you try the solution at http://www.sitepoint.com/forums/showthread.php?t=627677 that worked for 3 others?

After a few tries at reinstalling php 5.3 and rebooting numerous times, it is now working without any changes to the original code in the book.
Thanks for the suggestion.

I too came right when installing php5.3, however then there’s the problem of php5.3/Vista SP1 & having to use 127.0.0.1 instead of localhost. Is there not a solution to the original problem? There are clearly many users experiencing it!

Thanks,
Jeremy

I posted something about localhost yesterday, this was for Windows 7, not sure if Vista SP1 has the same issue.

http://www.sitepoint.com/forums/showthread.php?t=646601

Basically, I had to uncomment the line in C:\Windows\System32\drivers\etc in the hosts file that mapped 127.0.0.1 to localhost. (i.e., take out the # sign in front of it).

If there is no entry in the hosts file, you can always add one:

127.0.0.1 localhost

I’ve had to do a lot of hosts file stuff with Windows Servers in the past.

Maybe this will help.