Hi Guys
I am running windows xp and php 5.35 and mysql databases 8.0 and apache 2.27
When I run a simple php script (test.php) to connect to a mysql database and retrieve data, I get this:
Fatal error: Call to undefined function mysql_connect()
I know it is because Php cannot locate the mysql library so as adviced on the net I set the following as follows:
1. update php.ini file in my C:/windows folder as follows:
;extension_dir = "./" ===> extension_dir = "C:/php/ext"
2. set the environment system : path= C:/php
The php_mssql.dll is located in C:/php/ext and the libmysql.dll driver is in C:/php so both should be found by the php engine. However, When I try to connect to mysl using php
(from test.php) I still get the same error call:
Fatal error: Call to undefined function mysql_connect()
Meanwhile I am able to update my database using command line calls to mysql. So clearly the fault lies with my Php set up.
The test.php script is as follows:
----------------------------------
<?php
$con=mysql_connect("localhost","root","01959719");
// Check connection
if (mysql_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);
}
?>
---------------------------------------
PLEASE ADVICE
Thanks
PHP Fatal Error: Call to Undefined Function mysql_connect()
Moderator: General Moderators
Re: PHP Fatal Error: Call to Undefined Function mysql_connec
None of those versions exist.xbear1982 wrote:php 5.35 and mysql databases 8.0 and apache 2.27
Did you also uncomment the line
Code: Select all
extension = php_mysql.dllRe: PHP Fatal Error: Call to Undefined Function mysql_connec
sorry I make the mistake it is mysql 6.0 and php 5.3.5 and appache webserver 2.2
I remove the # character in extention in php.ini. but the problem still exist
Please help
Thanks in advance
I remove the # character in extention in php.ini. but the problem still exist
Please help
Thanks in advance
Re: PHP Fatal Error: Call to Undefined Function mysql_connec
There's no MySQL 6.0 either.
The extension= line will have a semicolon, not a hash sign. And did you restart?
The extension= line will have a semicolon, not a hash sign. And did you restart?