Fatal error: Call to undefined function: mysql_error() in /var/www/htdocs/test5.php

I am trying to connect to MYSQL server; so far I’ve been unsuccessful.
I am getting the following error massage:

Fatal error: Call to undefined function: mysql_error() in /var/www/htdocs/test5.php on line 10

Facts:
1) I compiled PHP with MYSQL
2) MYSQL is working properly. I can log in create databases so on and so forth...
3) PHP is working properly. I can out date in my browser so on and so forth
4) My code:

<?
$username="rionel";
$password="haiti";
$database="books";

$link=mysql_connect($localhost,$username,$password);
if (!$link) {
   die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
?>

I tried mysql_connect and mysqli_connect

5) php version: php-5.1.1
6)mysql version: mysql-5.0.15
7) phpinfo page:

Configure Command
'./configure' '--prefix=/usr' '--disable-static' '--with-apxs=/usr/sbin/apxs' '--sysconfdir=/etc' '--enable-discard-path' '--with-config-file-path=/etc/apache' '--enable-safe-mode' '--with-openssl' '--with-mhash' '--enable-bcmath' '--with-bz2' '--with-pic' '--enable-calendar' '--enable-ctype' '--with-gdbm' '--with-db3' '--with-imap-ssl=/usr/local/lib/c-client' '--with-imap=/usr/local/lib/c-client' '--enable-dbase' '--enable-ftp' '--with-iconv' '--with-exif' '--enable-exif' '--with-gd' '--enable-gd-native-ttf' '--with-jpeg-dir=/usr' '--with-png' '--with-gmp' '--with-mysql=shared,/usr' '--with-gettext=shared,/usr' '--with-expat-dir=/usr' '--with-xml' '--enable-wddx' '--with-mm=/usr' '--enable-trans-sid' '--enable-shmop' '--enable-sockets' '--with-regex=php' '--enable-sysvsem' '--enable-sysvshm' '--enable-yp' '--enable-memory-limit' '--with-tsrm-pthreads' '--enable-shared' '--disable-debug' '--with-zlib=/usr'

LVL 3
247RealMediaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

todd_farmerCommented:
When you tried mysqli_connect, did you also change the mysql_error to mysqli_error?
snoyes_jwCommented:
You must configure PHP to work with MySQL.
- Edit php.ini, and uncomment the line extension=mysql.so (extension=mysql.dll on Windows)
- If on Windows, make sure libmysql.dll is available to the system path.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jason C. LevineDon't talk to me.Commented:
Are you sure $localhost will work for the MySQL server?
virmaiorCommented:
the correct answer is from:
snoyes_jw is relating the source of the problem...


but jason1178's comment is also worth noticing.  You've never defined $localhost, which means that it will translate to '' which is going to be blank and give localhost.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.