Jump to content

noob question regarding an "If" statement.. i think..


jbrill

Recommended Posts

Hey guys, I have a question i need answered, to finalize this little program i am making.

I have a page that i would like text to appear "complete" if all the fields in a table in the row "status" are equal to "Complete"

and if they are not all set to "complete" in that row, then i would like the text to display "Incomplete"

how would i do this?

 

page one:

Job id: $jobid

stepid: $stepid

status text: "complete" or "incomplete"

 

 

table:work_hours

row name: status

 

I dont know if that made any sense... lol

amy help is appreciated. thanks

 

 

 

Link to comment
Share on other sites

When you say all fields this implies to me that there are more then one? Yeah Im a bit confused on what your asking.

 

If you just need to check the fiield and make sure it is set to complete. Just pull a query on that table and do this:

 

if($row['status'] == "Complete"){
echo "Complete";
}else{
echo "Not Complete";
}

 

Sorry if that is way off,..

Link to comment
Share on other sites

ok, this code is similar to what im looking for but i need to add one more thing.

 

in the table that it is going to check to see if it is equal to "complete" there are multiple rows that need to be "complete"

for example:

table1

 

has a job_id, step_id, status

 

Heres what i need to do:

if job_id=$jobid AND step_id=$stepid

then do the if statement, and only appear ass "complete" if all are complete. If so much as one is still "Incomplete" then i need the text to display incomplete

Link to comment
Share on other sites

When you say all fields this implies to me that there are more then one? Yeah Im a bit confused on what your asking.

 

If you just need to check the fiield and make sure it is set to complete. Just pull a query on that table and do this:

 

if($row['status'] == "Complete"){
echo "Complete";
}else{
echo "Not Complete";
}

 

Sorry if that is way off,..

 

This works, but only if the table has only one field for the status.. my table will have multiple rows, if all are complete, i would liek this to display complete. heres what i have so far:

<?

$partquery="SELECT * FROM processes WHERE job_id=$jobid AND step_id=$stepid";
$partinfo = mysql_query($partquery);
$row = mysql_fetch_array($partinfo);

if($row['complete'] == "Complete"){
echo "Complete";
}else{
echo "Not Complete";
}
?>

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.