Kyberia v1.0
[mirrors/Kyberia-bloodline.git] / admin / dbselect.php
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 $describe=$_GET['describe'];
8 $table=$_GET['table'];
9 $where=$_GET['where'];
10
11 ?>
12 <form action='?' method='get'>
13 describe
14 <input type='text' name='describe' value='<? echo $describe;?>'>
15 <input type='submit' value='send'>
16 </form>
17 <form action='?' method='get'>
18 select * from
19 <input type='text' name='table' value='<? echo $table;?>'>
20 where
21 <input type='text' name='where' value='<? echo $where;?>'>
22 <input type='submit' value='send'>
23 </form>
24 <br>
25 <?
26
27
28 if ($table) selectni($table,$where);
29 if ($describe) descni($describe);
30
31 function descni($tablename){
32 global $database;
33 $q="describe $tablename";
34 $set=$database->query($q);
35
36 echo "<table border='1'><tr><td><b>Field</b></td><td><b>Type</b></td> <td><b>Null</b></td></tr>";
37 while($set->next()){
38 $field=$set->getString('Field');
39 $fields[]=$field;
40 $type=$set->getString('Type');
41 $null=$set->getString('Null');
42 echo "<tr><td>".$field."</td>";
43 echo "<td>".$type."</td>";
44 echo "<td>".$null."</td></tr>";
45 }
46 echo "</table>";
47 }
48
49
50
51
52 function selectni($tablename,$where){
53 global $database;
54 $q="describe $tablename";
55 $set=$database->query($q);
56 if ($where=="") {
57 $q2="select * from $tablename";
58 }else{
59 $where=StripSlashes($where);
60 $q2="select * from $tablename where $where";
61 }
62 echo $q2."<br>";
63 $set2=$database->query($q2);
64
65 while($set->next()){
66 $field=$set->getString('Field');
67 $fields[]=$field;
68 $type=$set->getString('Type');
69 $null=$set->getString('Null');
70 }
71 echo "<table border='1'><tr>";
72 for($i=0;$i<count($fields);$i++){
73 echo "<td><b>".$fields[$i]."</b></td>";
74 }
75
76 echo "</tr><tr>";
77
78 while($set2->next()){
79 for($i=0;$i<count($fields);$i++){
80 $onefield=$set2->getString($fields[$i]);
81 echo "<td>".$onefield."</td>";
82 }
83 echo "</tr><tr>";
84 }
85 echo "</tr></table>";
86 }
87 ?>
This page took 0.31456 seconds and 4 git commands to generate.