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