0
$array = mysqli_fetch_array(mysqli_query($link,$result));

Is this a correct PHP/mysqli statement or do I have to run the query first and then the array fetching in two separate statements?

1
  • Does your code work? Commented Oct 11, 2016 at 18:51

1 Answer 1

1

The code should do, what you want. Assuming the $result, despite the strange name, is really an SQL query string.

But make sure you have configured mysqli to throw exceptions on error. Otherwise in case of error you will have no means to get the error message.

(Credits go to @Your Common Sense)

Sign up to request clarification or add additional context in comments.

6 Comments

@YourCommonSense Why do you think so?
Because result will be discarded and thus released all associated resources in destructor
OK, I see, because there's no reference to the results anymore, right?
Yes, exactly. So technically this code is all right.
You cannot as it's accepted. But you can edit it and then I can delete mine )
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.