From 4aa232983c59760412112f5c77b9aeb06ab58a27 Mon Sep 17 00:00:00 2001 From: Indieteq Date: Fri, 30 Aug 2013 18:56:27 +0200 Subject: Renamed index.example.php to index.php You'll instantly see the results if you browse to the folder. --- index.example.php | 47 ----------------------------------------------- index.php | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 47 deletions(-) delete mode 100644 index.example.php create mode 100644 index.php diff --git a/index.example.php b/index.example.php deleted file mode 100644 index 783a08e..0000000 --- a/index.example.php +++ /dev/null @@ -1,47 +0,0 @@ -bind("firstname","John"); - $db->bind("age","19"); - - // 2. Bind more parameters - $db->bindMore(array("firstname"=>"John","age"=>"19")); - - // 3. Or just give the parameters to the method - $db->query("SELECT * FROM Persons WHERE firstname = :firstname AND age = :age", array("firstname"=>"John","age"=>"19")); - - // Fetching data - $person = $db->query("SELECT * FROM Persons"); - - // If you want another fetchmode just give it as parameter - $persons_num = $db->query("SELECT * FROM Persons", null, PDO::FETCH_NUM); - - // Fetching single value - $firstname = $db->single("SELECT firstname FROM Persons WHERE Id = :id ", array('id' => '3' ) ); - - // Single Row - $id_age = $db->row("SELECT Id, Age FROM Persons WHERE firstname = :f", array("f"=>"Zoe")); - - // Single Row with numeric index - $id_age_num = $db->row("SELECT Id, Age FROM Persons WHERE firstname = :f", array("f"=>"Zoe"),PDO::FETCH_NUM); - - // Column, numeric index - $ages = $db->column("SELECT age FROM Persons"); - - // The following statemens will return the affected rows - - // Update statement - $update = $db->query("UPDATE Persons SET firstname = :f WHERE Id = :id",array("f"=>"Johny","id"=>"1")); - - // Insert statement -// $insert = $db->query("INSERT INTO Persons(Firstname,Age) VALUES(:f,:age)",array("f"=>"Vivek","age"=>"20")); - - // Delete statement -// $delete = $db->query("DELETE FROM Persons WHERE Id = :id",array("id"=>"6")); -?> \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 0000000..b96b482 --- /dev/null +++ b/index.php @@ -0,0 +1,47 @@ +bind("firstname","John"); + $db->bind("age","19"); + + // 2. Bind more parameters + $db->bindMore(array("firstname"=>"John","age"=>"19")); + + // 3. Or just give the parameters to the method + $db->query("SELECT * FROM Persons WHERE firstname = :firstname AND age = :age", array("firstname"=>"John","age"=>"19")); + + // Fetching data + $person = $db->query("SELECT * FROM Persons"); + + // If you want another fetchmode just give it as parameter + $persons_num = $db->query("SELECT * FROM Persons", null, PDO::FETCH_NUM); + + // Fetching single value + $firstname = $db->single("SELECT firstname FROM Persons WHERE Id = :id ", array('id' => '3' ) ); + + // Single Row + $id_age = $db->row("SELECT Id, Age FROM Persons WHERE firstname = :f", array("f"=>"Zoe")); + + // Single Row with numeric index + $id_age_num = $db->row("SELECT Id, Age FROM Persons WHERE firstname = :f", array("f"=>"Zoe"),PDO::FETCH_NUM); + + // Column, numeric index + $ages = $db->column("SELECT age FROM Persons"); + + // The following statemens will return the affected rows + + // Update statement + $update = $db->query("UPDATE Persons SET firstname = :f WHERE Id = :id",array("f"=>"Johny","id"=>"1")); + + // Insert statement +// $insert = $db->query("INSERT INTO Persons(Firstname,Age) VALUES(:f,:age)",array("f"=>"Vivek","age"=>"20")); + + // Delete statement +// $delete = $db->query("DELETE FROM Persons WHERE Id = :id",array("id"=>"6")); +?> -- cgit v1.1