jbrill Posted July 23, 2007 Share Posted July 23, 2007 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 Quote Link to comment Share on other sites More sharing options...
Wildbug Posted July 23, 2007 Share Posted July 23, 2007 We need more information. Are these "rows" in a database? Divulge more detail, please. Quote Link to comment Share on other sites More sharing options...
piznac Posted July 23, 2007 Share Posted July 23, 2007 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,.. Quote Link to comment Share on other sites More sharing options...
jbrill Posted July 24, 2007 Author Share Posted July 24, 2007 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 Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 24, 2007 Share Posted July 24, 2007 $value=($job_id==$jobid && $step_id==$stepid )? 'complete':'bleh incomplete'; echo $value; ternary operator very simple and short Quote Link to comment Share on other sites More sharing options...
jbrill Posted July 25, 2007 Author Share Posted July 25, 2007 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"; } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.