5 //$x = new PDO("oci:dbname=hostname", 'php', 'php');
6 $x = new PDO("sqlite::memory:");
8 $x->query("create table test(name string, value string)");
11 $stmt = $x->prepare("INSERT INTO test (NAME, VALUE) VALUES (:name, :value)");
13 $stmt->bindParam(":name", $the_name, PDO_PARAM_STR
, 32);
14 $stmt->bindParam(":value", $the_value, PDO_PARAM_STR
, 32);
16 for ($i = 0; $i < 4; $i++
) {
17 $the_name = "foo" . rand();
18 $the_value = "bar" . rand();
20 if (!$stmt->execute()) {
28 foreach ($x->query("select NAME, VALUE from test") as $row) {
35 public $NAME = "Don't change me";
40 foreach ($x->query("select NAME, VALUE from test", PDO_FETCH_COLUMN
, 1) as $row) {
41 debug_zval_dump($row);
47 $stmt = $x->prepare("select NAME, VALUE from test where value like ?");
49 $stmt->execute(array($the_name)) or die("failed to execute!");
50 $stmt->bindColumn('VALUE', $value);
52 while ($row = $stmt->fetch()) {
53 echo "name=$row[NAME] value=$row[VALUE]\n";
54 echo "value is $value\n";
58 echo "Let's try an update\n";