Chezshire Posted November 8, 2012 Share Posted November 8, 2012 (edited) I'm attempting to set display some data pulled from the database and present it in a table so i can get everything to line up correctly. When I attempt to form a table around it, the content hops out of the table or part of it does not display. Working on the first row, it currently displays 'CITIZENSHIP: USA' //if ($citizenship) { echo "<strong>CITIZENSHIP:</strong> $citizenship"; If I try this, it displays 'USA', the citizenship 'vanishes'. //if ($citizenship) { echo "<tr> // <td align=\"right\" valign=\"top\"><p><strong>CITIZENSHIP:</strong></p></td> // <td width=\"10\"> </td> // <td valign=\"top\"><p>" . $citizenship . "</p> // </td></tr>"; <table cellpadding=\"0\" cellspacing=\"0\"> <?php //if ($citizenship) { echo "<tr> // <td align=\"right\" valign=\"top\"><p><strong>CITIZENSHIP:</strong></p></td> // <td width=\"10\"> </td> // <td valign=\"top\"><p>" . $citizenship . "</p> // </td></tr>"; if ($citizenship) { echo "<strong>CITIZENSHIP:</strong> $citizenship"; if ($legalstatus) { echo ", $legalstatus"; } echo "<br >\n"; } else if ($legalstatus) { echo "<strong>Legal Status:</strong> $legalstatus"; } // end legal status if ($type=="administrator" || $type=="alumni" || $type=="faculty" || $type=="staff" || $type=="student") { $theseFields = array("placeofbirth", "maritalstatus", "occupation", "affiliation"); } else { $theseFields = array("placeofbirth", "maritalstatus", "occupation", "affiliation", "baseofoperations"); } // end if resident foreach ($theseFields as $thisField) { if (${$thisField}) { echo "<strong>" . ${$thisField . "Name"} . ":</strong> "; echo ${$thisField}; if (isset(${"former" . $thisField})) { if (${"former" . $thisField}) { echo " (formerly " . ${"former" . $thisField} . ")"; } } // end if set } // end if info } // end FOREACH if ($type=="administrator" || $type=="alumni" || $type=="faculty" || $type=="staff" || $type=="student") { ?> </table> ANy help would be greatly appreciated. I'm very much a newb. Thanks to anyone kind enough to try to help me with this. I've been struggling with this all day and i really thought it'd tage a few minutes. Thanks Edited November 8, 2012 by Chezshire Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted November 8, 2012 Share Posted November 8, 2012 What are you doing with your if statememnt ( I've not had my coffee yet, so brain is still half asleep...)? I can give you a class to make a table from a dataset, but the dataset needs to be complete before it gets to the class. Also, what's your query look like? 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.