Moderators Kyle Posted January 9, 2011 Moderators Report Share Posted January 9, 2011 Hey guys, I'm trying to firgutre out what the code is of the status of the PIREP. here's my code $pirep->status"; Is it wrong or what? I want to display the stats of the PIREP, like rejected or approved. How can I do that? Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted January 9, 2011 Report Share Posted January 9, 2011 it is $pirep->accepted 0 = pending 1 = accepted 2 = rejected Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted January 9, 2011 Author Moderators Report Share Posted January 9, 2011 Thanks lorathon, I'll give that a try. Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted January 9, 2011 Author Moderators Report Share Posted January 9, 2011 ok, so. It seems to work, but Still not sure what to do like disply the status like for ex) If it's still pending, I want to say Pending If it's apprvoed, I want to say Approved How are they worked in a way to know the number to say the status of the PIREP? P.S. sorry for being little annoying. I'm starting to trasit into php after times of skinning. Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted January 9, 2011 Administrators Report Share Posted January 9, 2011 if($pirep->status == 0){echo 'Pending';} elseif($pirep->status == 1){echo 'Approved';} else {echo 'Rejected';} 1 Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted January 9, 2011 Author Moderators Report Share Posted January 9, 2011 Thanks simpilot, I see how they work together for saying at a certain status. Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted January 9, 2011 Author Moderators Report Share Posted January 9, 2011 Umm, seems it does not work as it is supoosed to be. Ok I'll explain what I am doing I'm creating a Recent PIREPS and I'm trying to get the status in order to what it says, here's it is the code how it is right now...... echo "<td align=center> $pirep->status == 0){echo 'Pending';} elseif($pirep->status == 1){echo 'Approved';} else {echo 'Rejected';} </td>"; So if the PIREP is still pending, I want it to say Pending, ETC..... But It's still showing the if($pirep->status == 0){echo 'Pending';} elseif($pirep->status == 1){echo 'Approved';} else {echo 'Rejected';} on the recent PIREP status, is there something I'm missing to display the correct thing? Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted January 10, 2011 Administrators Report Share Posted January 10, 2011 echo '<td align=center>'; if($pirep->status == 0){echo 'Pending';} elseif($pirep->status == 1){echo 'Approved';} else {echo 'Rejected';} echo '</td>'; 1 Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted January 10, 2011 Author Moderators Report Share Posted January 10, 2011 Thanks simpilot Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted February 5, 2011 Author Moderators Report Share Posted February 5, 2011 Ok, I'm bring this topic back up, it never worked. So, here's my code...... foreach ($pireps as $pirep) { $pilotinfo = PilotData::getPilotData($pirep->pilotid); $pilotid = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid); echo "<tr>"; echo "<td align=center> $pirep->code $pirep->flightnum </td>"; echo "<td align=center> $pilotid $pilotinfo->firstname $pilotinfo->lastname </td>"; echo "<td align=center> $pirep->depicao </td>"; echo "<td align=center> $pirep->arricao </td>"; echo "<td align=center> $pirep->aircraft </td>"; echo "<td align=center> if($pirep->status == 0){echo 'Pending';} elseif($pirep->status == 1){echo 'Approved';} else {echo 'Rejected';} echo '</td>"; } } Now I'm not sure, why it's showing like that in the status colum. if( == 0){echo 'Pending';} elseif( == 1){echo 'Approved';} else {echo 'Rejected';} echo ' Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted February 5, 2011 Author Moderators Report Share Posted February 5, 2011 Ok, now I'll have shame on my self I better start using the serach feature casue I found one. Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted February 5, 2011 Author Moderators Report Share Posted February 5, 2011 Opening it up again, I got one problem......... I want to add the DIV style tag to the code I pasted below, it'll keep giving me parse error....... if($pirep->accepted == 0) { $status = "<div class="Pending CSS">Pending</div>"; } else if($pirep->accepted == 1) { $status = "Accepted"; } else { $status = "Denied"; } Any help please thanks! Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted February 6, 2011 Moderators Report Share Posted February 6, 2011 Someting like this? <td align="center"> <?php if($report->accepted == PIREP_ACCEPTED) echo '<div id="success">Accepted</div>'; elseif($report->accepted == PIREP_REJECTED) echo '<div id="error">Rejected</div>'; elseif($report->accepted == PIREP_PENDING) echo '<div id="pending">Pending</div>'; elseif($report->accepted == PIREP_INPROGRESS) echo '<div id="error">Flight in Progress</div>'; ?> </td> This is what i use. 1 Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted February 6, 2011 Author Moderators Report Share Posted February 6, 2011 Yeah I tried that too. I'll repost my code here again so you can see what the heck it's like. Here's a piece of it....... <?php if(count($pireps) > 0) { foreach ($pireps as $pirep) { $pilotinfo = PilotData::getPilotData($pirep->pilotid); $pilotid = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid); if($pirep->accepted == 0) { $status = "PENDING"; } else if($pirep->accepted == 1) { $status = "APPROVED"; } else { $status = "REJECTED"; } echo "<tr>"; echo "<td>'.$pirep->code.$pirep->flighnum.'</td>"; echo "<td>'.$pirep->depicao.'</td>"; echo "<td>'.$pirep->arricao.'</td>"; echo "<td>'.$pirep->aircraft.'</td>"; echo "<td>'.$pirep->flighttime.'</td>"; echo "<td>'.$pilotid.' '.$pilotinfo->firstname.' '.$pilotinfo->lastname.'</td>"; echo "<td>'.$pirep->flighttype.'</th>"; echo "<td>'.$status.'</td>"; echo "</tr>"; } } else { Thanks for your help again. 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.