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 6162889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:43:58+00:00 2026-05-23T21:43:58+00:00

I have output from a select query as below id price valid 1000368 69.95

  • 0

I have output from a select query as below

id          price  valid    
1000368     69.95   1       
1000369     69.94   0       
1000370     69.95   0 

now in php I am trying to pass the id 1000369 in function. the funciton can execute only if the valid =1 for id 1000368. if it’s not 1 then it will throw error. so if the id passed is 1000370, it will check if valid =1 for 1000369.

how can i check this? I think it is logically possible to do but I am not able to code it i tried using foreach but at the end it always checks the last record 1000370 and so it throws error.

regards

  • 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-23T21:43:59+00:00Added an answer on May 23, 2026 at 9:43 pm

    Use a boolean variable:

    <?php
    $lastValid=false;
    while($row = mysql_fetch_array($result))
    {
        if ($lastValid) {
            myFunction();
        }
        $lastValid = $row['valid'];
    }
    ?>
    

    (Excuse possible errors, have no access to a console at the moment.)

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

Sidebar

Related Questions

I have tried the below query: select empno from ( select empno from emp
I am trying to debug a segfault, and I have this output from gdb:
I have different php output in jQuery-based tabs. This output is formed from database
I have a table as shown below The output from said table Green, is
I'm trying to get a output parameter from MySQL stored procedure, let's have look
I have a single entry output from a paradox table which is imported into
I have an array of output from a database. I am wondering what the
I have a quite big XML output from an application. I need to process
I have a list of objects output from ldapsearch as follows: dn: cn=HPOTTER,ou=STUDENTS,ou=HOGWARTS,o=SCHOOL dn:
I have the mytest.cc and mytest.h output from a mytest.proto file, but I can't

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.