Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6575271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:21:58+00:00 2026-05-25T15:21:58+00:00

Here is an example of what I am trying to understand: return (@mysql_query($sql)) ?

  • 0

Here is an example of what I am trying to understand:

return (@mysql_query($sql)) ? true:false;

I want to return either true or false if this line is executed successfully:

$this->sql->execute();

Can someone explain me how this if like thing works and how can I use it with my line?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:21:58+00:00Added an answer on May 25, 2026 at 3:21 pm

    This statement executes the mysql_query() call and if it was successful, returns the boolean TRUE from the function in which it resides. If the SQL query fails, it returns boolean FALSE.

    Whether or not you can use this construct depends on if you expect your execute() call to return a result set (in a SELECT statement) or if it is used for INSERT/UPDATE/DELETE. If you attempt this with a SELECT statement, you would not be able to fetch your result rows with this statement.

    If it is only for INSERT/UPDATE/DELETE, you may be able to do

    return $this->sql->execute() ? true : false;
    

    However, we still can’t be sure this will work because you have not posted the contents of the class from which execute() is called.

    The ternary operator is used to assign or return one value or another based on the result of a condition.

    $returned_or_assigned_value = condition ? true_return_val : false_return_val;
    

    Ternary operations are very commonly used to assign one of two values to a variable. Using them in a return statement is a similar operation, if you think of the variable assignee as the function’s return.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand generics. Here's an example of one: public static bool
I'm trying to understand the Observer and the Observable. Here's an example that I'm
This is a followup to this question. Here's the code I'm trying to understand
Here's an example of the query I'm trying to convert to LINQ: SELECT *
I am trying to integrate Qt with OpenCV. Here is the example: http www
I'm trying to comprehend ontology basics. Here's an example: car (class) 2009 VW CC
Going from the example given here... http://ericswann.org/blog/archive/2009/04/06/linq-to-sql-datacontext-provider-revisited.aspx I'm trying to use the datacontext between
Here's what I've been trying to do, in a nutshell: class example <T extends
I'm trying to create an access control system. Here's a stripped down example of
The fictional example here. Suppose I designed a class named IODevice. This class already

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.