Please help

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
xbear1982
Forum Newbie
Posts: 9
Joined: Sun Aug 18, 2013 10:50 pm

Please help

Post by xbear1982 »

Hi Everyone
I am facing this error do not know how to fix it
with codeing
<?php
$con=mysql_connect("localhost","root","01959719");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

// Create database
$sql="CREATE DATABASE customer";
if (mysql_query($con,$sql))
{
echo "Database aqurium created successfully";
}
else
{
echo "Error creating database: " . mysql_error($con);
}
?>
Call to undefined function mysql_connect()
I already check on the extention on php.ini file in the folder. Please kindly help .
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Please help

Post by Celauran »

This has nothing to do with frameworks. Please try to post in the right forum.
You're mixing mysql_ and mysqli_ functions. As I have already mentioned in another of your threads, they are not the same thing and cannot be used interchangeably.

Check phpinfo() to see if the mysql extension is being loaded. Better still, stop using it. mysql_ has been deprecated and is going to be removed from PHP altogether. Use PDO instead.
Post Reply