summary refs log tree commit diff stats
path: root/includes/functions.php
blob: e0a5ab88e8b52a8b88ea769473acf83133382cd5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php

function has_meta($id, $name)
{
  global $mysql_conn;
  $getmeta = $mysql_conn->prepare("SELECT * FROM meta WHERE comic_id = ? AND name = ?");
  $getmeta->bind_param("is", $id, $name);
  $getmeta->execute();
  $getmeta2 = $getmeta->get_result();
  $getmeta3 = $getmeta2->fetch_assoc();

	if ($getmeta3['name'] == $name)
	{
		return true;
	}

	return false;
}

function get_meta($id, $name)
{
  global $mysql_conn;
  $getmeta = $mysql_conn->prepare("SELECT * FROM meta WHERE comic_id = ? AND name = ?");
  $getmeta->bind_param("is", $id, $name);
  $getmeta->execute();
  $getmeta2 = $getmeta->get_result();
  $getmeta3 = $getmeta2->fetch_assoc();

	return $getmeta3['value'];	
}

function next_comic_id()
{
  global $mysql_conn;
	$getcomic = $mysql_conn->query("SELECT * FROM comics WHERE status = \"publish\" ORDER BY comic_id DESC LIMIT 0,1");
  $getcomic3 = $getcomic->fetch_assoc();

	return ($getcomic3['comic_id']+1);
}

?>