3

I just downloaded the new xampp and try to run my old projects and I got this error

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in F:\xampp\htdocs\try\index.php:17 Stack trace: #0 {main} thrown in F:\xampp\htdocs\try\index.php on line 17

Does it mean that the mysql_connect that I used is not already supported in new xampp ?

3
  • 2
    The MySQL extension has been deprecated for some years now, and was removed in PHP7.... you really should be using MySQLi or PDO Commented Jan 1, 2016 at 15:03
  • It has been removed in PHP 7, you should use PDO or Mysqli to interact with mysql databases. Mysql_* functions have been deprecated for quite some time. Commented Jan 1, 2016 at 15:03
  • 1
    @RajdeepPaul That doesn't seem to be the right duplicate, it doesn't say anything about PHP 7. Commented Jan 1, 2016 at 15:12

3 Answers 3

12
mysql_connect()

has been removed from PHP7, which is used by the newest xampp version.

Instead, use mysqli_connect() like in this example.

Another method, PDO is also possible (but is coded in a very different way as mysql_connect.)

Sign up to request clarification or add additional context in comments.

2 Comments

I didn't say it is difficult ;) I only said it was different from mysqli_connect in terms of coding :p
1

The MySQL module is depreciated in PHP5 and removed in PHP7, you can use these:

Check your version by using phpinfo().

4 Comments

While correct the problem here is that mysql_* has been removed from PHP 7, not that it's deprecated from PHP 5
there are so many question available like that on SO...
@Barmar: you are genius in modification.... thumbs up
I know, quite depressing to see how many still haven't jumped on PDO/mysqli. They were introduced when, more than 10 years ago? At least the next couple of years will clean up some of the old mess - with PHP 7 being rolled out
0

Not particularly by xamppp but php itself deprecated mysql Here a quote from them:

The original MySQL extension is now deprecated, and will generate E_DEPRECATED errors when connecting to a database. Instead, use the MySQLi or PDO_MySQL extensions

if you can provide us php version i can help more

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.