mirror of
https://github.com/jcreek/Assassins-Mission-Control.git
synced 2026-07-13 02:53:44 +00:00
MySQL -> MySQLi changes begun
It was throwing an error about MySQL being depreciated with Connect and suggesting a move to MySQLi
This commit is contained in:
@@ -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
|
||||
?>
|
||||
@@ -2,8 +2,8 @@
|
||||
<?php
|
||||
//get the number of rows in the table *THIS WORKS
|
||||
function GetNumberOfRows() {
|
||||
$result = mysql_query( "select count(UserID) as num_rows from users" );
|
||||
$row = mysql_fetch_object( $result );
|
||||
$result = mysqli_query( "select count(UserID) as num_rows from users" );
|
||||
$row = mysqli_fetch_object( $result );
|
||||
$total = $row->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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user