Hi! I tried to connect to a MySQL database I created but it keeps giving me this error :

Fatal error: Call to undefined function: mysql_connect() in /var/www/html/first.php4 on line 13

I have checked using the phpinfo() function and it shows
that php is configured with mysql enabled (--with-mysql=shared,/usr). I am using php 4.1.2 running on linux and apache.

I tried installing the rpms found in http://rpmfind.net/linux/rpm2html/search.php?query=php-mysql
but still in vain. I am lost as to what to do as I am new to php,mysql and apache.

    have you installed mysql? can you connect to mysql from the command prompt? and stop using unhelpful titles for your posts - everyone is here for help for goodness sake, why not help them out by giving them a clue as to what your problem is.

    You'll find you'll get a lot more help (in theory) that way.

      yeah I guess that's a bad title ... will put more useful titles before I post it in future. ... I have already got mysql working and have created a database with it. the problem is, as I see it, both php and mysql has been installed on the machine. php has already been configured to work with mysql but it still can't recognize the function used like mysql_connect(); my code looks like this -->

      $db = mysql_connect("localhost", "root")
      or die("Could not connect!");

      mysql_select_db("myfirstdb",$db);

      $result = mysql_query("SELECT * FROM person",$db);

      printf("ID: %d<br>\n", mysql_result($result,0,"ID"));

      printf("Name: %s<br>\n", mysql_result($result,0,"Name"));

      printf("Position: %s<br>\n", mysql_result($result,0,"Position"));

      printf("Remarks: %s<br>\n", mysql_result($result,0,"Remarks"));
      ?>

      I keep getting the message as before :
      Warning: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /var/www/html/first.php4 on line 13
      Does anyone encounter this before? Thanx!

        So am I!

        If you don't follow the rules and post a subject title that has meaning to your problem at hand. 😃

          Write a Reply...