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

  • Home
  • SEARCH
  • 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 7862231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:03:02+00:00 2026-06-02T23:03:02+00:00

i have a query, $theresult = mysql_query(SELECT * FROM table WHERE column_b = .$variable);

  • 0

i have a query,

$theresult = mysql_query("SELECT * FROM table WHERE column_b = ".$variable);

so this will produce a list of results, 3 columns.

what i want to do is check if any of the rows of the result have “27” in column C.

i dont need the results, just a true/false..

thank you!

  • 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-06-02T23:03:03+00:00Added an answer on June 2, 2026 at 11:03 pm

    Hi i think you want to check that column c of any row has value 27 or not in fetching result PHP..then

    1.If you can add condition column_c = 27 then use mysql_num_rows for count number of rows in result

       $result = mysql_query("select * from table where column_b = ".$variable." AND column_c = 27") or die(mysql_error());
    
     if($result){
       if(mysql_num_rows($result) > 0){
         echo "true";
       }else{
         echo "false";
      }
     }
    

    2.If you not want to change in mysql query then

     $result = mysql_query("select * from table where column_b = ".$variable."") or die(mysql_error());
    
     $exist = "false";
    
     if($result){
       while($row = mysql_fetch_array($result)){
          if($row['column_c'] == 27){
            $exist = "true";
          }
       }
     }
     echo $exit;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this query in my sql if (select count(*) from sys.columns where object_id
If I have this: $results = mysql_query(SELECT * FROM table_name WHERE id=$id); is there
I have query like this : SELECT EXTRACT(MONTH FROM d.mydate) AS synmonth, SUM(apcp) AS
I have table tree. I have query: SELECT * FROM tree WHERE pid =10
I have this elementary query: SELECT d.description, o.code FROM order_positions AS o LEFT JOIN
I have a MySQL query like this: SELECT cp.plan_name, cp.plan_time FROM courses c INNER
I have query table copyQuery which has Soil Condition has one of the columns,
I have a simple MySQL query like: SELECT * FROM `content_category` CC , `content_item`
I have a query that looks like this: select id , int1 , int2
I have a select statement returning 5 columns: select col1,col2,col3,col4,col5 from table1; col1 col2

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.