Jump to content

Archived

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

aeroboy

mysql_connect an undefined function??

Recommended Posts

Hello,

I have recently installed php5.1.4 and MySQL5.0.22 on my Windows Server 2003 server computer.  I tried a simple connect by creating a file with the following code:
[code]<html>
<body>
<?php
$con = mysql_connect('localhost','root','MyRootPassword');
if (!$con)
  {
  die("Could not connect: " . mysql_error());
  }
?>
</body>
</html>
[/code]

I get the following error message when I try to view this file in IE:

PHP Fatal error: Call to undefined function mysql_connect() in MyFileLocation on line 5

Can anyone help?
I installed php on my hard drive i.e. C:\php
I installed MySQL on my hard drive as well i.e C:\Program Files\MySQL

Thanks in advance

Share this post


Link to post
Share on other sites
I think you need to be using the new mysqli set of libraries...

Share this post


Link to post
Share on other sites
If you are using PHP5, then you need to enable the mysql extension in order to use the mysql functions. [url=http://www.phpfreaks.com/forums/index.php/topic,95378.0.html]This thread[/url] should be of help.

Share this post


Link to post
Share on other sites
Thanks, guys...
after researching and listening to you guys, I went to

<a href="http://dev.mysql.com/downloads/connector/php/"> http://dev.mysql.com/downloads/connector/php/
</a>

and downloaded the mysqli extension.  After that didn't work, the mysql extension worked fine.  Your linked thread was perfect, wildteen.

THANKS!!

8)

Share this post


Link to post
Share on other sites
If you want to use the mysqli replated functions you can do, by enabling the mysqli extension.

Share this post


Link to post
Share on other sites

×

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.