PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
create table posts ( id int auto_increment primary key, author varchar(255), post text ); insert into posts(author, post) values ('rozhnev', 'Online PHP & SQL sandbox');
Copy Clear
Copy Format Clear
<?php $postId = 1; $author = 'rozhnev'; $pdo_statement = $pdo->prepare('SELECT * FROM posts WHERE id = ? and author = ?'); $pdo_statement->execute([$postId, $author]); $post = $pdo_statement->fetch(PDO::FETCH_ASSOC); // fetch data var_dump($post);
Show:  
Copy Clear