Jump to content

Trouble Displaying/formating Data In A Table (Help)


Chezshire

Recommended Posts

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

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?

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.