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

 

 

 

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,..

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

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";
}
?>

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.