problem with mysql and php
hello,
i'm facing a problem with my php and mysql. my mysql server is running properly and when i'm writtng script in php it's ok , but when i'm trying to connect to mysql server from a php script i'm getting : Fatal error: Call to undefined function: mysql_connect() in /usr/local/httpd/htdocs/test.php on line 8. here ici the code : <?php //session_start(); //phpinfo(); $user="root"; $password="nabila"; $database="bouboul"; mysql_connect(localhost,$user,$password); echo mysql_error(); ?> when i'm running phpinfo() function i can see the that mysql is enabled (-with-mysql=shared,/usr'). is there any module i should load in the httpd.conf file or something else? i'm a newbie, pleaz help me ? thanx |
dont you need to ' select ' the correct database before connecting ?
|
Yeah, I aggree with technowax. You need a "mysql_select_db (<database name>);" line in there. Since you've defined $database, you could use "mysql_select_db ($database);".
Another problem could be that you need to put quotes around "localhost". Hope that helps. |
Fatal error: Call to undefined function: mysql_connect()
i didn't really to intend to select any database , my probelm is that apache /php are not recognizing mysql functions while mysql server is running nicely alone as well as php /apache.
wha can i do ? |
All times are GMT -5. The time now is 06:57 PM. |