p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Beginning PHP (http://p2p.wrox.com/forumdisplay.php?f=95)
-   -   Undefined Function Error (http://p2p.wrox.com/showthread.php?t=34291)

arimakidd October 14th, 2005 12:20 PM

Undefined Function Error
I am building this script step by step and the first step is not working. Simply to connect to mysql, here's the code:

$connect = mysql_connect("localhost","root","newman$") or
die ("Hey loser, check your server connection.");
echo "if you gotten this far it means things worked out";

Instead I get the following error:


Fatal error: Call to undefined function mysql_connect() in C:\apache\Apache2\development\mysql_up.php on line 11
Line 11 is as follows:

$connect = mysql_connect("localhost", "root", "newman$")
My OS is xp pro and I have successfully installed apache and php5. Mysql works fine at the command prompt. The script I am writting is in php and the entire thing is simple and short:

$host = "localhost";
$user = "root@localhost";
$pass = "newman$";
//connect to MySQL; note we've used our own parameters - you should use
//you own for hostname, user, and password
$connect = mysql_connect("localhost", "root", "newman$") or
die ("Hey loser, check your server connection.");

Need Help[?]

anshul October 19th, 2005 01:48 PM

See o/p of phpinfo(). PHP5 has no automatic working module of MySQL, you need enable it.

Support Indian students' finances http://scholarship.mediasworks.com/

imranphp November 10th, 2005 02:54 AM

do the following
1)include your php path (e.g c:\php)in the enviroment variables.
my computer-->Properties-->Advanced-->Enviroment Variables-->Select "PATH" from the list and press Edit.go to the end of line and
enter your php path for example c:\php

2)Copy php_mysql.dll to c:\php (or to your php path). if it is already there then ok.
   (you can find it in the ext folder of your php folder)
3)copy libmysql.dll to c:\php (or to your php path). if it is already there then ok.

4)Open php.ini file and add the following line in the extension list
  Save and close file.

5)restart your system.

6)Your above code is right now run it again.
          thanks (imran ali)

All times are GMT -4. The time now is 09:19 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.