Page 1 of 1

XAMPP 7.2.0 MySQL error: Call to undefined function mysql_se

PostPosted: 21. April 2018 19:25
by lack0Fdesign
error msg: Fatal error: Uncaught Error: Call to undefined function mysql_select_db() in X:\geoLatLng.anm8\public_html\test-02.php:28 Stack trace: #0 {main} thrown in X:\geoLatLng.anm8\public_html\test-02.php on line 28

WAMP server (windows error for anyone searching)

Code: Select all
<?php


// DB

   error_reporting(E_ALL);
   ini_set('display_errors', '1');
   define('DB_HOST', 'localhost');
   define('DB_NAME', 'nuckinfuts');
   define('DB_USER', 'root');
   define('DB_PASSWORD', '');
   
   $con = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD);
   //echo DB_HOST;
   if (!$con){
      die('Could not connect: ' . mysql_error());
   }
   
   mysql_select_db(DB_NAME, $con) or die(mysql_error());
   
   session_start();
?>


it fails locally but on the live server running FreeBSD I have no issues.

I'm beating my head against the wall, any help would be greatly appreciated.

Re: XAMPP 7.2.0 MySQL error: Call to undefined function mysq

PostPosted: 21. April 2018 22:20
by Altrea
Hi,

This code is a horrible mix of old mysql_ and new mysqli_ functions.
The old functions was removed since PHP 7.0.0-
The only reason it is working on your live host must be an old PHP version.

Change your code to consistently new mysqli_ functions.

best wishes,
Altrea

Re: XAMPP 7.2.0 MySQL error: Call to undefined function mysq

PostPosted: 21. April 2018 23:35
by lack0Fdesign
Thanks Andrea, I'll read up when I get free time :/

Most programming books I have are next to the toilet so I can study without kids yelling heheh

Re: XAMPP 7.2.0 MySQL error: Call to undefined function mysq

PostPosted: 24. April 2018 12:05
by shah alam
Upon XAMPP,first I, by mistake sent Mysql login fail error report to Oracle. I understand that any software cannot be activated unless we log into that software concern.So I loggin into sites ofOracle as well as Apachefriends.Now I see that I may log in MySQL but Admin button next to start is not activated. If anybody may help in the name of God who may save our life n afterlife only..Thank you.