ExamVeda
Login
Home
This question belongs to MySQL MySQL Miscellaneous
MySQL Miscellaneous
?

What does mysql_query() return on failure?

Answer & Solution
Correct Answer: Option D
This question is about how MySQL tells you if a query failed. Think of it like trying to open a door. Sometimes it opens (success!), and sometimes it doesn't (failure!).

In MySQL, the `mysql_query()` function is like trying to open that door. When it works, it means your query was successful. But if it fails, you need a way to know.

Here's how `mysql_query()` signals failure:
* Option A: 0 - This is actually the signal for success! It means the door opened.
* Option B: 1 - This is *not* the failure signal. It's just another number that *doesn't* indicate a problem.
* Option C: -1 - This *could* be the failure signal, depending on the specific MySQL version and setup.
* Option D: a non-zero - This is the most common way `mysql_query()` indicates failure. A non-zero number (like 2, 3, or anything other than 0) means the door didn't open.

So, the answer is Option D: a non-zero. It's the most reliable way for `mysql_query()` to let you know your query didn't work.
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.