Jump to content


Photo

mysql_connect an undefined function??


  • Please log in to reply
4 replies to this topic

#1 aeroboy

aeroboy
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 20 July 2006 - 01:48 PM

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:
<html>
<body>
<?php
$con = mysql_connect('localhost','root','MyRootPassword');
if (!$con) 
  {
  die("Could not connect: " . mysql_error());
  }
?>
</body>
</html>

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


#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 20 July 2006 - 04:08 PM

I think you need to be using the new mysqli set of libraries...
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 20 July 2006 - 04:13 PM

If you are using PHP5, then you need to enable the mysql extension in order to use the mysql functions. This thread should be of help.

#4 aeroboy

aeroboy
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 20 July 2006 - 06:18 PM

Thanks, guys...
after researching and listening to you guys, I went to

<a href="http://dev.mysql.com...onnector/php/"> http://dev.mysql.com.../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)

#5 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 20 July 2006 - 07:42 PM

If you want to use the mysqli replated functions you can do, by enabling the mysqli extension.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users