$temp2 = substr($random, 0, strpos($random, ';')); $random = substr($random, strpos($random, ';') + 1); //$temp= "<option value='".$temp2."'>".$temp2."</option>"; //$option = $option.$temp; $count++; $list = $list . $temp2 . ","; } } } else { //echo "No Start Value"; } //SQLLite section try { /*** connect to SQLite database ***/ //$dbh = new PDO("sqlite:database.sdb"); PDO_Connect("sqlite:database.sdb"); } catch (PDOException $e) { echo "Connect Error: " . $e->getMessage() . "<br>"; } $exists = "SELECT name FROM sqlite_master WHERE type='table' AND name='IDs'"; $name = PDO_FetchOne($exists); //echo "name: ".$name."<br>".$exists."<br>"; //echo $QNameStr; if ($name == '') { $create = "Create table IDs (Id INTEGER PRIMARY KEY)"; PDO_Execute($create); //print $create; } if ($e == null) { try { //$dbh->exec("Delete from IDs");
// $content = fread($fh, filesize("filename.ext")); //fclose($fh); /*printer_set_option($handle, PRINTER_MODE, "text"); printer_write($handle, "TEXT To print"); printer_close($handle); */ } ?> <?php //Using PDO lib PHP desktop has provided. include "./pdo.php"; $db_file = "./restaurant.sqlite3"; PDO_Connect("sqlite:{$db_file}"); //Fetch data from DB $All = PDO_FetchAll("SELECT * FROM users WHERE age < :age", array("age" => 20000)); //Array ( [0] => Array ( [name] => dasd [age] => 2000 ) ) // Selects all elements till 20000. //print_r($All); //echo "<br>"; $age = PDO_FetchOne("SELECT age FROM users WHERE name = :name", array("name" => "omt")); //Select one column from the row with some specific details know. //print_r($age); //echo "<br>"; $rowdetails = PDO_FetchRow("SELECT * FROM users WHERE name = :name", array("name" => "omt")); // Select complete row from a table //print_r($rowdetails); //echo "<br>"; $association = PDO_FetchAssoc("SELECT name, age FROM users");
<td class="none" colspan="2" style="padding-top: 0.4em;"><input type="submit" value="Connect"></td> </tr> </table> </form> </body> </html> <?php exit; } // ------------------------------- // @connect // ------------------------------- if (SQLITE_USED) { PDO_Connect("sqlite:" . SQLITE_FILE); } else { db_connect($db_server, $db_name, $db_user, $db_pass); } if ($db_charset && "mysql" == $db_driver) { db_exe("SET NAMES {$db_charset}"); } // ------------------------------- // @dump // ------------------------------- GET("dump_all", "int"); if (1 == $_GET['dump_all']) { // @structure dump_all($data = false); } else { if (2 == $_GET['dump_all']) {