PHP and MYSQL

Advancewarning advancewarning at swbell.net
Wed Jan 22 16:20:20 CST 2003


It shows up I have the MySQL Database in there.  I created a new
database called 'pratt' and created a table called 'Info' but it doesn't
seem to work.

Michael Pratt
Pratt's Computers
http://pratt.is-a-geek.com
MCSE, CNA
 

-----Original Message-----
From: Eric R. [mailto:rossiter at discoverynet.com] 
Sent: Wednesday, January 22, 2003 10:14 AM
To: Advancewarning
Cc: KCLUG
Subject: Re: PHP and MYSQL

Advancewarning wrote:
> What is the trick to getting PHP to connect to MYSQL?
> 
>  
> 
> It blows up at this line:
> 
> $connection = mysql_connect("$server","$username","$password");
> 
>  
> 
> Giving me this:
> 
> *Fatal error*: Call to undefined function: mysql_connect() in 
> */web/test.php* on line *15*
> 

Well, as it was so elequently explained to me... :)

mysql_connect can't find the database that it's looking for.

Create a test page called info.php:

<?php phpinfo() ?>

Open it in your browser... you should see a block of information about 
MySQL... (my guess is, right now, it won't be there)

(If it IS there, have you loaded the default MySQL DB after MySQL 
install??  I belive that was a fix for an earlier glitch of this sort.)

If you compiled from source, run ./configure again with the --with-mysql

option.

Depending on your location of MySQL, it would look something like:

./configure --prefix=/usr/local/php 
--with-config-file-path=/usr/local/php --with-mysql=/usr/local/mysql 
--with-apxs=/usr/sbin/apxs --enable-track-vars --enable-magic-quotes 
--enable-debugger

If you're using rpm's, good luck, never got'em to work.

Have a quality day,
E




More information about the Kclug mailing list