Commit | Line | Data |
---|---|---|
bc13d5d6 H |
1 | <? |
2 | ||
3 | ini_set("include_path","./inc:./boxiky/:./config:../inc:../boxiky/:../config"); | |
4 | include_once("kyberia.inc"); | |
5 | $database=new CLASS_KYBERIA(); | |
6 | ?> | |
7 | <form action='?' method='get'> | |
8 | describe | |
9 | <input type='text' name='describe'> | |
10 | <input type='submit' value='send'> | |
11 | </form> | |
12 | <form action='?' method='get'> | |
13 | select * from | |
14 | <input type='text' name='table'> | |
15 | where | |
16 | <input type='text' name='where'> | |
17 | <input type='submit' value='send'> | |
18 | </form> | |
19 | <br> | |
20 | <? | |
21 | ||
22 | $describe=$_GET['describe']; | |
23 | $table=$_GET['table']; | |
24 | $where=$_GET['where']; | |
25 | ||
26 | if ($table) selectni($table,$where); | |
27 | if ($describe) descni($describe); | |
28 | ||
29 | function descni($tablename){ | |
30 | global $database; | |
31 | $q="describe $tablename"; | |
32 | $set=$database->query($q); | |
33 | ||
34 | echo "<table border='1'><tr><td><b>Field</b></td><td><b>Type</b></td> <td><b>Null</b></td></tr>"; | |
35 | while($set->next()){ | |
36 | $field=$set->getString('Field'); | |
37 | $fields[]=$field; | |
38 | $type=$set->getString('Type'); | |
39 | $null=$set->getString('Null'); | |
40 | echo "<tr><td>".$field."</td>"; | |
41 | echo "<td>".$type."</td>"; | |
42 | echo "<td>".$null."</td></tr>"; | |
43 | } | |
44 | echo "</table>"; | |
45 | } | |
46 | ||
47 | ||
48 | ||
49 | ||
50 | function selectni($tablename,$where){ | |
51 | global $database; | |
52 | $q="describe $tablename"; | |
53 | $set=$database->query($q); | |
54 | if ($where=="") { | |
55 | $q2="select * from $tablename"; | |
56 | }else{ | |
57 | $q2="select * from $tablename where $where"; | |
58 | } | |
59 | echo $q2."<br>"; | |
60 | $set2=$database->query($q2); | |
61 | ||
62 | while($set->next()){ | |
63 | $field=$set->getString('Field'); | |
64 | $fields[]=$field; | |
65 | $type=$set->getString('Type'); | |
66 | $null=$set->getString('Null'); | |
67 | } | |
68 | for($i=0;$i<count($fields);$i++){ | |
69 | echo "|:|<b>".$fields[$i]."</b>"; | |
70 | } | |
71 | ||
72 | echo "<br>"; | |
73 | ||
74 | while($set2->next()){ | |
75 | for($i=0;$i<count($fields);$i++){ | |
76 | $onefield=$set2->getString($fields[$i]); | |
77 | echo "|:|".$onefield; | |
78 | } | |
79 | echo "<br>"; | |
80 | } | |
81 | } | |
82 | ?> |