Ik heb een classje geschreven voor wat basisquerys uit te voeren en dat zit samen met een html form dat ik getest heb en blijkt te werken. Als ik die pagina echter bezoek is die blanco. Hier is de class. What's wrong?
PHP:
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
42
| if($submit){ class sql{ var $statement var $result var $query var $server $this->server = mysql_connect("localhost", "", ""); mysql_select_db("", $server); function query($statement){ $this->query = mysql_query($statement); } function fetch_row($statement){ $this->query = mysql_query($statement); $this->result = mysql_fetch_row($query); } } if($type = "2"){ $query->fetch_row("SELECT fid from forums where category_id = $category_id"); $query->query(Update forums set fid = fid+1 and category_id=category_id +1 where fid > $result['1']) $query->query(INSERT INTO forums (fid, category_id, name, description, lastpost, lpuser, lptime) Values(NULL, '$name', '$description', '','','','')); } if($type = "1"){ //category_id is the id of the forum parent that the admin selects $query_forum = new sql("SELECT fid from forums where category_id = $category_id +1") $result = $query_forum->fetch_row(); //if there is a category after the parent category of the forum we are going to add set the forum ids of that category all + 1 so tehre is room to fint a forum in if($result['1']){ $query->query(Update forums set fid = fid + 1 where fid > ($result['1'] - 1)); } $query->query(INSERT INTO forums (fid, name, description, lastpost, lpuser, lptime) Values(NULL, '$name', '$description', '','','','')); } } |