Forum Moderators: coopster

Message Too Old, No Replies

PHP Connecting to MySQL DB Error

         

wfernley

4:54 pm on Jan 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi. I have been learning PHP and MySQL for the past little while using Dreamweaver MX on my localhost MySQL. I tried uploading to my partners server where he has MySQL.

Everytime I try to connect I get this error:

Fatal error: Call to undefined function: mysql_pconnect() in /firestormclients/Connections/firestormclients.php on line 9

In the firestormclients.php file I have this code:

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_firestormclients = "friendsserver";
$database_firestormclients = "firestorm";
$username_firestormclients = "username";
$password_firestormclients = "password";
$firestormclients = mysql_pconnect($hostname_firestormclients, $username_firestormclients, $password_firestormclients) or die(mysql_error());
?>

Now my partner gave me an address but not an IP address, and of course I changed the username and password so no one can see :P.

Can anyone explain this error to me? Is it on my end or his?

Thanks.

Wes

pete_m

5:04 pm on Jan 9, 2004 (gmt 0)

10+ Year Member



Hi Wes

The problem is on your partner's server. He has compiled php without MySQL support - it can be solved by recompiling php on his server with the flag "--with-mysql"

justageek

5:06 pm on Jan 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



From php:

Note, that these kind of links only work if you are using a module version of PHP.

Just use mysql_connect and see if that works.

JAG

wfernley

5:24 pm on Jan 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi, thanks for the replies.

I tried mysql_connect and it still doesn't work.

jatar_k

7:25 pm on Jan 10, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



try it this way

$dbhost = "localhost";
$dbuser = "username";
$dbpass = "password";
$connection = mysql_connect($dbhost,$dbuser,$dbpass) or die ("<p>Error Connecting: " . mysql_error());

then see if it gives you an error and what it is. That may help you get more info about what is happening.

wfernley

12:34 pm on Jan 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey. Thanks for the reply. I tried that different code, and it still shows the same error.

Wes

coopster

2:14 pm on Jan 12, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I'm with pete_m in message # 2 here -- get your friend to make sure MySQL support indeed exists in his installation. He can use phpinfo() to confirm.

wfernley

2:34 pm on Jan 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yeah I'm going to have to talk to him. Thanks for your help though :)

Wes