Please rescue here: taking from PDO to mysqli

Hi guys,

i would to know some corresponding PDO to mysqli object-oriented:

I know this is PDO:
$sql = ‘SELECT id FROM joke WHERE authorid = :id’;
$s = $pdo->prepare($sql);
$s->bindValue(’:id’, $_POST[‘id’]);
$s->execute();

How can i write in mysqli obeject-oriented?

to what the PDOelement ‘:id’ correspond in mysqli object oriented ?

Thanks…

Have you looked on your own?

I personally would just learn PDO, if you want to just to use OOP style. The example you give can easily be written as the following:

[php]$sql = ‘SELECT id FROM joke WHERE authorId=:authorId’;
$stmt = $pdo->prepare($sql);
$stmt->execute[ ‘:authorId’ => $_POST[‘authorId’] ];[/php]

I never really didn’t like working with mysqli for they have those silly ? marks along with the corresponding type i for integer, s for string, etc… PDO is much easier to work with once you get the hang of it.

Sponsor our Newsletter | Privacy Policy | Terms of Service