Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/03/2023 in all areas

  1. Here's the code you have: $query_result = mysqli_query($query); The "procedural style" mentioned in the docs shows this: mysqli_query(mysqli $mysql, string $query, int $result_mode = MYSQLI_STORE_RESULT): mysqli_result|bool You read it like this: 1. This is a function named "mysqli_query" 2. The first parameter is called $mysql - at least in the documentation itself, you can name your variables whatever you want - and it is a mysqli (that's a class) value 3. The second parameter is called $query and is a string value 4. The third parameter is called $result_mode and is an int(eger) value; it has a default value of MYSQLI_STORE_RESULT, which will apply when you do not pass a third argument 5. The function returns a value that is mysqli_result|bool, meaning it will be a mysqli_result (another class) value or a bool(ean) value The Parameters section gives more details about those three parameters. Same for the Return Values section and the return value. There's also an Errors/Exceptions that is useful to understand when and why the function may or may not behave correctly. But back on topic: The first parameter is not optional - there is no default value, so you must provide one yourself. You have done so with your $query variable; remember, your variable can be named whatever you want. But there's a problem: the parameter is supposed to be a mysqli value, and you provided a query string. The second parameter is not optional either, however you are not providing one. That's what PHP is complaining about. If you combine those two facts together, the problem should be pretty clear: you need to call the function with a mysqli and a query string, but you only called it with a query string. I'm guessing this was originally based on mysql (no 'i') code? There is a mysql_query function but it isn't the same as the mysqli_query function.
    1 point
This leaderboard is set to New York/GMT-05:00
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.