Jump to content

help with mysql and php


Recommended Posts

HI
I get this error

Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Group\Apache2\htdocs\connect.php on line 2

when i use this code

<?php
$link = mysql_connect('localhost 3306', 'root', 'hetal123');
if (!$link) {
  die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>


i edited PHP.ini and httpd.conf file and still no luck
can anybody help me?
Link to comment
https://forums.phpfreaks.com/topic/33662-help-with-mysql-and-php/
Share on other sites

The sticky thorpe is refereeing to is the thread labelled [b]Call To Undefined Function mysql_connect[/b]

That thread provides a link to an FAQ [url=http://www.phpfreaks.com/forums/index.php/topic,95378.0.html]here[/url]. This FAQ will help to sort out this error.
No. It is to do with PHP having trouble loading up the MySQL extension.

There may be older versions of the following files on your computer that may be causing this:
- libmysql.dll
- php_mysql.dll

Search your computer for these files. php_mysql.dll should be in PHP's ext folder and libmysql should be listed in C:\WINDOWS and in MySQLs bin folder.

If the search finds any others rename these to something else, eg: libmysql.dll.bak

Restart your server. Do you still get the error message? Also have you added PHP to the Windows PATH?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.