newbie PHP/SQL problem

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Hi All,
    I've install a supposedly compatible combination of PHP, SQL with an
Apache server. Generally all individual components seem to operate fine. I
can create tables in the database using mysql and I can run basic PHP code
in my browser using the Apache server. Everything's running on my desktop

However,  whenever I use the mySQL related functions in my PHP, the php
script just stops. No error messages. Just nothing. For example, using
something like:

$conn = mysql_connect("localhost", "root", "")  or die(mysql_error());

in my php just stops the script dead. Everything up to this line executes
but nothing after it. This appears to be the same behaviour as if I put in a
non-existant function call. So my question is, how does the php know where
to find the SQL functions?. Is there any configuration required?. All of my
components came out of a book (with CD) and have been configured as

Any ideas?.


Re: newbie PHP/SQL problem

if it's a non-existant function call, add C:\PHP to your PATH, or put
libmysql.dll (mysql < 4.1) or libmysqli.dll (mysql >= 4.1) into
c:\windows\system32 (if you're on windows. if you're on linux, that's not my

Quoted text here. Click to load it

Re: newbie PHP/SQL problem

No, that doesn't work either.

I've run up the database using winmysqladmin.exe, run up the server. I've
copied my libmysql.dll into windows and windows/system directories.

 echo "It's alive! Aliiiive!";
 echo "Can't find it";

fails. There's no mention of mysql in the phpinfo() output. It mentions
SQLite but nothing about MySQL. I assume it should?.

Any more ideas?.


Quoted text here. Click to load it

Re: newbie PHP/SQL problem

Quoted text here. Click to load it

Would you normally get errormessages for any other kind of errors. Also:
there's a function function_exists, which tests if a function exsists. Try
something like
if(function_exists("mysql_connect")) echo "It's alive! Aliiiive!";
And then see what phpinfo(); prints about mysql. That might give you some
answers what's going on in there.

"I am pro death penalty. That way people learn
their lesson for the next time." -- Britney Spears

Re: newbie PHP/SQL problem

Dave Moore wrote:
Quoted text here. Click to load it

Which one?

I would suggest downloading XAMPP. Pretty much the best PHP/MySQL
package available. Includes PHP switcher, to switch from PHP 4.x to 5.x

Quoted text here. Click to load it

Open your PHP.INI and check if error_reporting is set correctly.

error_reporting  =  E_ALL & ~E_NOTICE

Set it like that and the die() command will spit out encountered errors,
which seems to be what you're looking for?

   ___|   ___|  _ \ _ _|  _ \__ __| __ \  |   | __ \  ____|
\___ \  |     |   |  |  |   |  |   |   | |   | |   | __|
       | |     __ <   |  ___/   |   |   | |   | |   | |
_____/ \____|_| \_\___|_|     _|  ____/ \___/ ____/ _____|
Computers will never take the place of books. You can't stand on a
floppy disk to reach a high shelf.
I thought 'Deep Throat' was a movie about a giraffe :/

Site Timeline