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 ?

Yuu
  • 619
  • 3
  • 13
  • 34
  • 2
    The MySQL extension has been deprecated for some years now, and was removed in PHP7.... you really should be using MySQLi or PDO – Mark Baker Jan 01 '16 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. – JimL Jan 01 '16 at 15:03
  • 1
    @RajdeepPaul That doesn't seem to be the right duplicate, it doesn't say anything about PHP 7. – Barmar Jan 01 '16 at 15:12

3 Answers3

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.)

Evochrome
  • 1,205
  • 1
  • 7
  • 20
1

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

Check your version by using phpinfo().

Barmar
  • 741,623
  • 53
  • 500
  • 612
devpro
  • 16,184
  • 3
  • 27
  • 38
  • 1
    While correct the problem here is that mysql_* has been removed from PHP 7, not that it's deprecated from PHP 5 – JimL Jan 01 '16 at 15:10
  • there are so many question available like that on SO... – devpro Jan 01 '16 at 15:11
  • @Barmar: you are genius in modification.... thumbs up – devpro Jan 01 '16 at 15:12
  • 1
    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 – JimL Jan 01 '16 at 15:13
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