From 8c4f48a73d43b9db9ddc3635e14c5f8f213eb73b Mon Sep 17 00:00:00 2001 From: jcreek Date: Tue, 4 Nov 2014 00:42:47 +0000 Subject: [PATCH] MySQL -> MySQLi changes begun It was throwing an error about MySQL being depreciated with Connect and suggesting a move to MySQLi --- base.php | 4 ++-- index.php | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/base.php b/base.php index 962ac02..4f0e9dc 100644 --- a/base.php +++ b/base.php @@ -11,7 +11,7 @@ $dbname = "assassins"; // the name of the database that you are going to use for $dbuser = "root"; // the username that you created, or were given, to access your database $dbpass = "root"; // the password that you created, or were given, to access your database -mysql_connect($dbhost, $dbuser, $dbpass) or die("MySQL Error: " . mysql_error()); -mysql_select_db($dbname) or die("MySQL Error: " . mysql_error()); +mysqli_connect($dbhost, $dbuser, $dbpass) or die("MySQL Error: " . mysqli_error()); +mysqli_select_db($dbname) or die("MySQL Error: " . mysqli_error()); //echo "success in database connection."; //Uncomment this line if you want to check if a page is loading this database connection code ?> \ No newline at end of file diff --git a/index.php b/index.php index 404f011..ec369e9 100644 --- a/index.php +++ b/index.php @@ -2,8 +2,8 @@ num_rows; return $total; } @@ -174,14 +174,14 @@ function GetNumberOfRows() { $username = mysql_real_escape_string($_POST['username']); $password = md5(mysql_real_escape_string($_POST['password'])); - $checklogin = mysql_query("SELECT * FROM users WHERE Username = '".$username."' AND Password = '".$password."'"); + $checklogin = mysqli_query("SELECT * FROM users WHERE Username = '".$username."' AND Password = '".$password."'"); //Get the number of players and send it to a session variable $numberofplayers = GetNumberOfRows(); $_SESSION['NumberOfPlayers'] = $numberofplayers; //Get the number of players with 'Alive' as their 'Status' and send that to a session variable - $getplayersalive = mysql_query("SELECT * FROM users WHERE Status = 'Alive'"); + $getplayersalive = mysqli_query("SELECT * FROM users WHERE Status = 'Alive'"); $numberofplayersalive = mysql_num_rows($getplayersalive); $_SESSION['NumberOfPlayersAlive'] = $numberofplayersalive; @@ -220,7 +220,7 @@ function GetNumberOfRows() { //Now set the Target Information //Query the database for the user with 'AssassinID'=$targetID and then - $targetinfo = mysql_query("SELECT * FROM users WHERE AssassinID = '".$targetid."'"); + $targetinfo = mysqli_query("SELECT * FROM users WHERE AssassinID = '".$targetid."'"); if(mysql_num_rows($targetinfo) == 1) {