Beispiel #1
0
 /**
  * Utility function to edit a single 
  * @param string $table_name
  * @param int $id
  * @param string $field
  * @param var $value
  * @return True on success, false otherwise.
  */
 public static function editField($table_name, $id, $field, $value)
 {
     $DbConnection = DbConnection::getInstance();
     $Row = new Row($table_name, (int) $id, $DbConnection);
     $Row->data[$field] = $value;
     return $Row->save();
 }
Beispiel #2
0
 public function testSave()
 {
     $name = "testuser";
     //create Phactory\Sql\Row object and add user to table
     $phactory_row = new Row('user', array('name' => $name), $this->phactory);
     $phactory_row->save();
     // retrieve expected user from database
     $stmt = $this->pdo->query("SELECT * FROM `users`");
     $db_user = $stmt->fetch();
     // test retrieved db row
     $this->assertEquals($db_user['name'], $name);
 }