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'; $mysqli_statement = $mysqli->prepare('SELECT * FROM posts WHERE id = ? and author = ?'); $mysqli_statement->bind_param('ds', $postId, $author); $mysqli_statement->execute(); $result = $mysqli_statement->get_result(); // get the mysqli result $post = $result->fetch_assoc(); // fetch data var_dump($post);
Copy Clear