From 3bfb275679c637b4ca5396dc1ce83ae9df7158de Mon Sep 17 00:00:00 2001 From: Ambrose Chua Date: Mon, 31 Oct 2016 02:10:10 +0800 Subject: [PATCH] I just realised... --- admin/index.php | 6 +++--- detail.php | 4 ++-- get.php | 4 ++-- index.php | 4 ++-- like.php | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/admin/index.php b/admin/index.php index b8b8ceb..428756e 100644 --- a/admin/index.php +++ b/admin/index.php @@ -40,14 +40,14 @@ include "../connect.php"; $mysql_table = MYSQL_TABLE; $qry = "INSERT INTO `$mysql_table` (`id`, `txt`, `tim`) VALUES (NULL, '".mysqli_escape_string(nl2br($txt.$extrl))."', '".mysqli_escape_string($tim)."')"; -$result = mysqli_query($qry); +$result = mysqli_query($db, $qry); if (!$result) { - die("Error! ".mysqli_error()); + die("Error! ".mysqli_error($db)); } else { $allok = 1; } -mysqli_close($link); +mysqli_close($db); } ?> diff --git a/detail.php b/detail.php index 20e3c6b..b2b170d 100644 --- a/detail.php +++ b/detail.php @@ -6,7 +6,7 @@ include "connect.php"; $mysql_table = MYSQL_TABLE; $qry="SELECT * FROM `$mysql_table` WHERE `id`='".mysqli_escape_string($_GET["id"])."'"; -$result=mysqli_query($qry); +$result=mysqli_query($db, $qry); if($result) { if(mysqli_num_rows($result) == 1) { $row = mysqli_fetch_array($result); @@ -29,5 +29,5 @@ if($result) { diff --git a/get.php b/get.php index 26ca092..4255d63 100644 --- a/get.php +++ b/get.php @@ -6,7 +6,7 @@ include "connect.php"; $mysql_table = MYSQL_TABLE; $qry="SELECT * FROM `$mysql_table` ORDER BY `$mysql_table`.`id` ASC LIMIT ".mysqli_escape_string($_GET["lastid"])." , 1000"; -$result=mysqli_query($qry); +$result=mysqli_query($db, $qry); $newlastid=$_GET["lastid"]; $jspo=array(); while ($row = mysqli_fetch_array($result)) { @@ -15,5 +15,5 @@ array_push($jspo, array("txt"=>stripslashes($row["txt"]), "tim"=>$row["tim"], "i } echo json_encode(array("posts"=>$jspo, "lastid"=>$newlastid)); -mysqli_close($link); +mysqli_close($db); ?> diff --git a/index.php b/index.php index c32be9e..96d7572 100644 --- a/index.php +++ b/index.php @@ -43,7 +43,7 @@ include 'checklogin.php'; include "connect.php"; $mysql_table = MYSQL_TABLE; $qry="SELECT * FROM `$mysql_table` ORDER BY `$mysql_table`.`id` DESC LIMIT 0, 30 "; - $result=mysqli_query($qry); + $result=mysqli_query($db, $qry); $iffirst=0; $newlastid="null"; while ($row = mysqli_fetch_array($result)) { @@ -54,7 +54,7 @@ include 'checklogin.php'; $iffirst=1; } } - mysqli_close($link); + mysqli_close($db); ?> diff --git a/like.php b/like.php index 56b7ae4..4bf7e5c 100644 --- a/like.php +++ b/like.php @@ -9,7 +9,7 @@ $starred=""; $mysql_table = MYSQL_TABLE; $qrya="SELECT * FROM `$mysql_table` WHERE `id`='".mysqli_escape_string($_GET["id"])."'"; -$resulta=mysqli_query($qrya); +$resulta=mysqli_query($db, $qrya); if($resulta) { if(mysqli_num_rows($resulta) == 1) { $rowa = mysqli_fetch_array($resulta); @@ -21,7 +21,7 @@ $stars=$stars+1; if (isset($_GET["plusone"])) { $qryb="UPDATE `$mysql_table` SET `pluses`='".($stars)."' WHERE `id`='".mysqli_escape_string($_GET["id"])."'"; - $resultb=mysqli_query($qryb); + $resultb=mysqli_query($db, $qryb); if($resultb) { $starred="Thanks for a ★! "; } else {