Click here to Skip to main content
15,896,118 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
First chek this simple code: ...............................................................................................................................................................

<?php
$mysql_host = 'localhost';
$mysql_user = 'root';
$mysql_pass = '';

@mysql_connect($mysql_host, $mysql_user, $mysql_pass) or die('Couldn not connect.'); echo 'Connected!';
?>
.................................................................................................................................................................

When I try to run the code above using Xampp server, the following error appears: ..............................
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\xampp\htdocs\Series\database\index.php:7 Stack trace: #0 {main} thrown in C:\xampp\htdocs\Series\database\index.php on line 7
...............................

I really need to sort thus out.

What I have tried:

I have no idea how to sort this
Posted
Updated 23-Jan-17 20:56pm

1 solution

Look that you are using PHP version 7. According to the documentation[^]
Quote:
Warning
This extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. Instead, the MySQLi or PDO_MySQL extension should be used. See also MySQL: choosing an API guide and related FAQ for more information. Alternatives to this function include:
mysqli_connect()
PDO::__construct()
Learn to do it correctly from PHP Connect to MySQL[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900