0

I am trying to send the request to API with the following code

  <?php
require 'connect.php';
$posts = mysqli_query($connect, query:"SELECT * FROM `api`");
print_r($posts);
 ?>

but it throws me

Parse error: syntax error, unexpected ':', expecting ')' in C:\xampp\htdocs\API\index.php on line 3

Aspire
  • 11
  • 1
  • 5
  • Have a look at the [manual](https://www.php.net/manual/en/function.mysqli-connect.php) as to how you are supposed to pass the parameters. – Nigel Ren May 20 '20 at 10:14
  • 1
    PHP doesn't have named parameters, only positional. Just use `mysqli_query($connect, "SELECT * FROM \`api\`");` (and make the same changes in your connect.php if required. – Nick May 20 '20 at 10:14

0 Answers0