<?php
$db = sqlite_open(":memory:");
if(!$db) die("Could not create the temporary database");
$query = "CREATE TABLE cities(name VARCHAR(255), state VARCHAR(2))";
sqlite_query($db, $query);
$cities[] = array('name' => 'Chicago','state'=> 'IL');
foreach($cities as $city) {
$query = "INSERT INTO cities VALUES(" ."'{$city['name']}', '{$city['state']}')";
if(!sqlite_query($db, $query)) {
trigger_error("Could not insert city " . "'{$city['name']}, {$city['state']}");
}
}
sqlite_close($db);
?>
|