Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

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');

Stuck with a problem? Got Error? Ask AI support!

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);
Copy Clear