020 555 1111
  • Old fashion, modular, procedural PHP plus some scaffolding techniques to allow it to mimic MVC simplicity.
  • A quick reference to help you find in PHP maze what needs to be done and how to do it.
  • Learn a PHP Object Oriented Programming by building a live discussion forum application.
  • MVC - Model View Controller - real life, easy reference and application.
This product has options, take a look at them and select ones you like the most.
Options are displayed under image section.
Top » PHP » misc

PDO db commands
[PDO misc]

se also: this link

example: 1

$sth = $this->db->prepare('INSERT INTO users 
			    ('login', 'password') 
			    VALUES (:login, :password)
			    ');

$sth->execute(array(
    ':login' => $data['login'],
    ':password' => $data['password']
));

 

example 2:

$sth = $this->db->prepare('SELECT id, login FROM users WHERE id = :id');
$sth->execute(array(':id' => $id));
return $sth->fetch();

 

example 3:

$sth = $this->db->prepare('SELECT id, login FROM users');
$sth->execute();
return $sth->fetchAll();

 

example 4:

$sth = $this->db->prepare('UPDATE users
			    SET 'login' = :login, 'password' = :password
			    WHERE id = :id
			    ');

$sth->execute(array(
    ':id' => $data['id'],
    ':login' => $data['login'],
    ':password' => $data['password']
));

 

example 5:

public function delete($id) {
    $sth = $this->db->prepare('DELETE FROM users WHERE id = :id');
    $sth->execute(array(
	':id' => $id
    ));
}