How to make a selection mysqli?

Hi all.
I must say that I'm not a programmer.
I had that kind of problem
$limit = 360;
$time = time();

$last_id = (int)$_GET['id'];


$mysqli = new mysqli('localhost', 'root', ", 'comet');

/* check connection */
if (mysqli_connect_errno()) {
 printf("failed to connect: %s\n", mysqli_connect_error());

function escape($str) {
 return str_replace('"','\"',$str);

$query = 'SELECT * FROM `comet` WHERE `id`>"'.$last_id.'" ORDER BY `id` ASC';

if ($result = mysqli_query($mysqli, $query)) {

 /* fetching data and putting them into an array */
 while ($row = mysqli_fetch_row($result)){
 echo 'self.putMessage("'.$row['id'].'","'.escape($row['name']).'","'.escape($row['text']).'");';

 /* free result set */


This code will take you back to the data via ajax every 5 seconds and check the database.
but an error occurs

PHP Warning: mysqli_fetch_row() expects exactly 1 parameter, 2 given in E:\Dropbox\shared\OpenServer\domains\comet\backend.php on line 26

How can I fix it?
July 8th 19 at 16:44
1 answer
July 8th 19 at 16:46
You or not the code cited, or error from another location. Using mysqli_fetch_row right, it takes 1 parameter, you can pass.

Find more questions by tags PHPMySQL