summary refs log tree commit diff stats
path: root/includes/functions.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/functions.php')
-rwxr-xr-xincludes/functions.php24
1 files changed, 15 insertions, 9 deletions
diff --git a/includes/functions.php b/includes/functions.php index edb666b..e0a5ab8 100755 --- a/includes/functions.php +++ b/includes/functions.php
@@ -2,9 +2,12 @@
2 2
3function has_meta($id, $name) 3function has_meta($id, $name)
4{ 4{
5 $getmeta = "SELECT * FROM meta WHERE comic_id = " . $id . " AND name = \"" . $name . "\""; 5 global $mysql_conn;
6 $getmeta2 = mysql_query($getmeta); 6 $getmeta = $mysql_conn->prepare("SELECT * FROM meta WHERE comic_id = ? AND name = ?");
7 $getmeta3 = mysql_fetch_array($getmeta2); 7 $getmeta->bind_param("is", $id, $name);
8 $getmeta->execute();
9 $getmeta2 = $getmeta->get_result();
10 $getmeta3 = $getmeta2->fetch_assoc();
8 11
9 if ($getmeta3['name'] == $name) 12 if ($getmeta3['name'] == $name)
10 { 13 {
@@ -16,18 +19,21 @@ function has_meta($id, $name)
16 19
17function get_meta($id, $name) 20function get_meta($id, $name)
18{ 21{
19 $getmeta = "SELECT * FROM meta WHERE comic_id = " . $id . " AND name = \"" . $name . "\""; 22 global $mysql_conn;
20 $getmeta2 = mysql_query($getmeta); 23 $getmeta = $mysql_conn->prepare("SELECT * FROM meta WHERE comic_id = ? AND name = ?");
21 $getmeta3 = mysql_fetch_array($getmeta2); 24 $getmeta->bind_param("is", $id, $name);
25 $getmeta->execute();
26 $getmeta2 = $getmeta->get_result();
27 $getmeta3 = $getmeta2->fetch_assoc();
22 28
23 return $getmeta3['value']; 29 return $getmeta3['value'];
24} 30}
25 31
26function next_comic_id() 32function next_comic_id()
27{ 33{
28 $getcomic = "SELECT * FROM comics WHERE status = \"publish\" ORDER BY comic_id DESC LIMIT 0,1"; 34 global $mysql_conn;
29 $getcomic2 = mysql_query($getcomic); 35 $getcomic = $mysql_conn->query("SELECT * FROM comics WHERE status = \"publish\" ORDER BY comic_id DESC LIMIT 0,1");
30 $getcomic3 = mysql_fetch_array($getcomic2); 36 $getcomic3 = $getcomic->fetch_assoc();
31 37
32 return ($getcomic3['comic_id']+1); 38 return ($getcomic3['comic_id']+1);
33} 39}