Jump to content

cosmosman

New Members
  • Posts

    1
  • Joined

  • Last visited

cosmosman's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. So, I took over a project from someone else, and I am trying to populate three columns in a table where there was previously two columns. I've almost got things figured out, but can't quite get my third column to fill. I've got it so its separating the the data into thirds, but only the left column actually has exactly one third of the data. The middle column has the other two thirds of data, and the right column has no data. Here is the code I am working with. However, I've changed what we produce to "stuff" and left out the url for privacy reasons: $iUp = 1; $pQuery = mysql_query($query) or die(mysql_error()); $pExist = mysql_num_rows($pQuery); if(!empty($pExist)){ //$this->stuffPackageOut .= '<form action="https://*************.111/cart" method="GET" name="stuff" onsubmit="return anyCheck()">'; //$this->stuffPackageOut .= '<form action="index.php" method="GET" name="stuff" onsubmit="return anyCheck()">'; $this->stuffPackageOut .= '<input type="hidden" name="cart!addFamily">'; $pCnt = $pExist; $pCntHalf = floor($pCnt/3); $stuff[0] = NULL; $stuff[1] = NULL; $stuff[2] = NULL; $div = 0; while($pRow = mysql_fetch_object($pQuery)){ if($pCntHalf < $iUp){ $div = 2; $div = 1; }else{ $div = 0; } $contribName = strtolower(str_replace(" ", "", $pRow->conName)); $stuffName = strtolower(str_replace(" ", "", $pRow->stfName)); $stuff[$div] .= '<tr><td valign="top"><input type="checkbox" name="cart_family'.$iUp.'" value="'.$pRow->familyId.'" id="package"> <a href="http://****************.com/stuff/'.$stuffName.'.php" class="packagestufflinks">'.$pRow->fntName.'</td></tr>'; $iUp++; } $stuffLeft = '<table width="137" border="0" cellspacing="8" cellpadding="0" height="10" valign="top">'; $stuffLeft .= $stuff[0]; $stuffLeft .= '</table>'; $stuffMiddle = '<table width="137" border="0" cellspacing="8" cellpadding="0" height="10" valign="top">'; $stuffMiddle .= $stuff[1]; $stuffMiddle .= '</table>'; $stuffRight = '<table width="137" border="0" cellspacing="8" cellpadding="0" height="10" valign="top">'; $stuffRight .= $stuff[2]; $stuffRight .= '</table>'; $this->stuffPackageOut .= '<table width="100%" height="10"><tr><td align="left" valign="top" width="238" height="10">'.$stuffLeft.'</td><td width="29" valign="top" background="verticaldivider.gif"><img src="http://www.****************.com/pageimages/spacer.GIF" width="29" height="5"></td><td align="left" valign="top" width="238">'.$stuffMiddle.'<td><td width="29" valign="top" background="verticaldivider.gif"><img src="http://www.****************.com/pageimages/spacer.GIF" width="29" height="5"></td><td align="left" valign="top" width="238">'.$stuffRight.'</td></tr></table>'; I know it has something to do with everything following the "while" coding, but since I don't do this for a living I have no idea what coding is necessary to make my three columns populate. Please help me.
×
×
  • 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.