LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   problem with mysql and php (https://www.linuxquestions.org/questions/linux-software-2/problem-with-mysql-and-php-112965/)

nshoboul 11-06-2003 03:58 AM

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

xconspirisist 11-06-2003 04:03 AM

dont you need to ' select ' the correct database before connecting ?

Travis86 11-06-2003 10:41 PM

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.

nshoboul 11-07-2003 02:50 AM

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 01:59 AM.