undefined function mysql_connect()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sivasyam
Forum Newbie
Posts: 2
Joined: Wed Jul 26, 2006 10:42 am

undefined function mysql_connect()

Post by sivasyam »

Pimptastic | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


hi all,

i run this programe

Code: Select all

<?php
$con = mysql_connect("localhost:3306","root","bisro");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
?>
on browser

then its display's the follwing error

Fatal error: Call to undefined function mysql_connect() in C:\bisro\examples\conn1.php on line 5

pls


Pimptastic | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Ward
Forum Commoner
Posts: 74
Joined: Thu Jul 13, 2006 10:01 am

Post by Ward »

You need to install the MySQL extension on your server.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

you running your own server or are you on a shared server (hosting company) :?:
sivasyam
Forum Newbie
Posts: 2
Joined: Wed Jul 26, 2006 10:42 am

Post by sivasyam »

i using my own server
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

You need to edit your php.ini to uncomment the php_mysql.dll line in the extensions section. I'd bet if you searched these forums you'd find the exact entry you need to make/edit.

HINT: Use the Search feature of these boards and serach for 'mysql extension', choose the 'Search for all terms' Option and enter 'Everah' as the author name. There are 9 results that will answer your question.

Or, just remove the semicolon from this line in php.ini...

Code: Select all

;extension=php_mysql.dll
Post Reply