Skip to Content
It is currently September 15th, 2019, 1:20 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: June 25th, 2019, 4:58 pm 
Offline
SVS Member
SVS Member

Joined: September 11th, 2004, 1:51 pm
Posts: 669
Location: PA
Code:
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /home/******/public_html/******/dedi.php:44 Stack trace: #0 {main} thrown in /home/******/public_html/******/dedi.php on line 44


Lines 44, 45, and 46.

Code:
Line 44: $db = mysql_connect($djsamip, $djsamname, $djsampass);
Line 45: mysql_select_db($djsamdb,$db);
Line 46: $result = mysql_query("SELECT * FROM queuelist q LEFT JOIN requestlist r ON q.requestid = r.id LEFT JOIN songlist s ON q.songid = s.id ORDER BY q.sortID ASC LIMIT 50",$db);


Would anyone know how I can fix this to use with PHP 7.2x

I did change mysql to mysqli, but that lead to a different error. Which is the following:

Code:
Warning: mysqli_select_db() expects parameter 1 to be mysqli, string given in


On line 45 & 46 & 78

Code:

line 45: mysqli_select_db($djsamdb,$db);
Line 46: $result = mysqli_query("SELECT * FROM queuelist q LEFT JOIN requestlist r ON q.requestid = r.id LEFT JOIN songlist s ON q.songid = s.id ORDER BY q.sortID ASC LIMIT 50",$db);

Line 78: if ($myrow = mysqli_fetch_array($result)){


And it shows the proper information, except it, shows the error above.

Only when using:
error_reporting(E_ALL);
ini_set('display_errors', 1);

Otherwise no errors show up.

_________________
Mark L. - SVS (Spacial Volunteer Support)
-------------------------------------------------
DJ Fire - CEO
http://www.crossfire-radio.com


Top
 Profile  
Reply with quote  
PostPosted: June 28th, 2019, 7:19 pm 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 7872
Location: Aachen (Germany)
The PHP mysql extension is deprecated since at least 10 years and the mysqli one works slightly different.
mysqli_select_db expects 2 params: #1 the connection identifier and #2 the database to select.
However it is strongly suggested to only use mysqli_select_db if you want to switch to a different database AFTER establishing a connection.
For selecting the database to initially connect to, simply pass the name as the 4th parameter to mysqli_connect.

From the php manual at php.net:
Example #1 Easy migration from the old mysql extension
Code:

<?php
$mysqli 
mysqli_connect("example.com""user""password""database");
$res mysqli_query($mysqli"SELECT 'Please, do not use ' AS _msg FROM DUAL");
$row mysqli_fetch_assoc($res);
echo 
$row['_msg'];

$mysql mysql_connect("example.com""user""password");
mysql_select_db("test");
$res mysql_query("SELECT 'the mysql extension for new developments.' AS _msg FROM DUAL"$mysql);
$row mysql_fetch_assoc($res);
echo 
$row['_msg'];
?>


Instead of trying to fix the old PHP templates from pre-2010, you could just switch to the "new" ones introduced in 2011 and last updated in April 2018 to be fully PHP7 compatible.

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

We're offering custom PAL / PHP code and general SAM assistance at palscripts.com

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group