Could somebody explain to me why the following is wrong :
$sql='SELECT * FROM images';
$hostname ='localhost';
$username= 'root';
$password= '';
$db= 'myDB';
$numRows=new mysqli($hostname, $username, $password, $db)->query($sql)-> num_rows;
The error throws is : syntax error, unexpected T_OBJECT_OPERATOR .....
and is it possible to correct it in one statement like above ? Thank you.