forked from dexterns88/fenix_db
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.html
191 lines (163 loc) · 6.02 KB
/
demo.html
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML+RDFa 1.1//EN">
<html class="no-js" lang="en" dir="ltr" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<!-- <link type="image/x-icon" href="favicon.png" rel="shortcut icon"> -->
<meta content="" name="description" />
<meta content="code sample , fenix_db fenix db , database" name="keywords" />
<meta name="author" content="webpage-lab" />
<link rel="stylesheet" type="text/css" href="style/style.css" >
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/script.js" type="text/javascript"></script>
</head>
<body>
<div id="page" class="region-page">
<div class="page-wrap">
<h1>Fenix Database function</h1>
<h2>Code sample</h2>
<p>Include library:</p>
<div class="code-div">
include_once('ini_db.php');
</div>
<p> Next step is to create db object</p>
<div class="code-div">
$baseApi = new Fenix_baseApi();
</div>
<hr>
<h3 id="select"><a name="select"></a>Select table and return value</h3>
<div class="code-div">
<ul>
<li>$arr_base = array (</li>
<ul>
<li>'table' => 'test_base', <span class="comment"> // name of table </span></li>
<li>'select' => array( <span class="comment"> // select array of table row witch wont to select </span></li>
<ul>
<li>'id',</li>
<li>'text'</li>
</ul>
<li>),</li>
<li>'where' => 'text = "djuro" ' <span class="comment"> // where condition see manuel for database </span> </li>
<li>'order' => 'asc' <span class="comment"> // how to sory returned value </span> </li>
</ul>
<li>);</li>
</ul>
</div>
<p> call function in object </p>
<div class="code-div">
$value = $baseApi -> fx_select( $arr_base );
</div>
<hr>
<h3 id="insert"><a name="insert"></a>Insert value into table</h3>
<div class="code-div">
<ul>
<li>$arr_base_insert = array(</li>
<ul>
<li>'table' => 'new_table4',</li>
<li>'value' => array(</li>
<ul>
<li>'FirstName' => 'dexter', <span class="comment">// FirstName is tablerow name where wont to insert 'dexter' text </span> </li>
<li>'LastName' => 'more test',</li>
<li>'Age' => '2'</li>
</ul>
<li>)</li>
</ul>
<li>);</li>
</ul>
</div>
<p>Call function in object </p>
<div class="code-div">
$value2 = $baseApi -> fx_insert( $arr_base_insert );
</div>
<hr>
<h3 id="delete"><a name="delete"></a>Delete data from table</h3>
<div class="code-div">
<ul>
<li>$arr_base_delete = array(</li>
<ul>
<li>'table' => 'test_base', <span class="comment">// name of table</span></li>
<li>'where' => ' id = 8 ' <span class="comment">// condition where like mysql where </span> </li>
</ul>
<li>);</li>
</ul>
<br/>
$val3 = $baseApi -> fx_delete($arr_base_delete); <span class="comment">// call function into object</span>
</div>
<hr>
<h3 id="create"><a name="create"></a>Create table into database</h3>
<div class="code-div">
<ul>
<li>$arr_base_create_table = array(</li>
<ul>
<li>'table' => 'new_table4', <span class="comment">// name of new table</span></li>
<li>'tableType' => 'innodb', <span class="comment">// type of table </span></li>
<li>'value' => array(</li>
<ul>
<li>'id' => 'int NOT NULL AUTO_INCREMENT', <span class="comment">// if id not defined script automatic add this field</span></li>
<li>'FirstName' => 'varchar(15)', <span class="comment">// first name is name of row witch wont to sreate second is type and length</span></li>
<li>'LastName' => 'varchar(15)',</li>
<li>'Age' => 'int'</li>
</ul>
<li>),</li>
<li>'primary' => 'id' <span class="comment">// if primary key not defined id automatic becomes primary key</span></li>
</ul>
<li>);</li>
</ul>
<br />
$value3 = $baseApi -> fx_createTable($arr_base_create_table);
</div>
<hr>
<h3 id="listTable"><a name="listTable"></a>List of all table in db</h3>
<div class="code-div">
$list = $baseApi -> fx_tableList();
</div>
<hr>
<h3 id="update"><a name="update"></a>Update value</h3>
<div class="code-div">
<ul>
<li>$arr_base_update = array(</li>
<ul>
<li>'table' => 'new_table', <span class="comment">// table witch want to update</span></li>
<li>'value' => array(</li>
<ul>
<li>'FirstName' => 'sasa', <span class="comment">FirstName is name of table row sasa is a value for update</span></li>
<li>'LastName' => 'des'</li>
</ul>
<li>),</li>
<li>'where' => "id = 1 or age = 22" <span class="comment">// condition witch field to update</span></li>
</ul>
<li>);</li>
</ul>
<br />
$update = $baseApi -> fx_update( $arr_base_update );
</div>
<h3 id="dropTable"><a name="dropTable"></a>Drop table</h3>
<div class="code-div">
<ul>
<li>$arr_base_drop = array(</li>
<ul>
<li>'table' => 'new_table1' <span class="comment">// table for drop</span></li>
</ul>
<li>);</li>
</ul>
<br/>
$drop = $baseApi -> fx_drop( $arr_base_drop );
</div>
</div> <!-- /page-wrapper -->
</div> <!-- /page -->
<div class="navigation">
<ul>
<li><a href="#select">Select table</a></li>
<li><a href="#insert">Insert value</a></li>
<li><a href="#delete">Delete data</a></li>
<li><a href="#create">Create table</a></li>
<li><a href="#listTable">List of all table</a></li>
<li><a href="#update">Update value</a></li>
<li><a class="last " href="#dropTable">Drop table</a></li>
</ul>
</div>
<div id="footer" class="region-footer">
<p class="cr">Copyright 2012 | All rights reserved</p>
<p class="pb">Powered by: <a target="_blank" href="http://www.webpage-lab.com">webpage-lab</a></p>
</div>
</body>
</html>