Jump to content

table. total. rollup = nogo


SireJoe

Recommended Posts

Ok, so Heres what I am tryin to do:

 

 

$ARCH0= mysql_query("SELECT IFNULL(descr, 'Total') AS descr, Clicks.idnum, clicks FROM Clicks, Partners WHERE Clicks.idnum=Partners.idnum GROUP BY Clicks.idnum, descr WITH ROLLUP");

 

echo "<table border='1' width='700' align='center' bgcolor='white' class='style4'>

<tr>

<th scope='col' width='10%' bgcolor='#666666'>#</th>

<th scope='col' width='10%' bgcolor='#666666'>ID</th>

    <th scope='col' width='60%' bgcolor='#666666'>Titles</th>

    <th scope='col' width='15%' bgcolor='#666666'>Clicks</th>

  </tr>";

while ($row = mysql_fetch_array($ARCH0)) {

if($cols == 0){

        echo "<tr>\n";

    }

printf("<td align='center' bgcolor='$bg'>$int</td>");

printf("<td align='center' bgcolor='$bg'>%s</td>", $row[0]);

printf("<td bgcolor='$bg'>%s</td>", $row[1]);

printf("<td align='center' bgcolor='$bg'>%s</td>", $row[2]);

    $cols++;

$int++;

switch($bg) {

case '#FFFFFF':

$bg= '#CCCCCC';

break;

case '#CCCCCC':

$bg= '#FFFFFF';

break;

}

    if($cols == $display){

        echo "</tr>\n";

        //$rows++;

$cols = 0;

  }

}

if($cols != $display && $cols != 0 && $rows != 0){

    $neededtds = $display - $cols;

    for($i=0;$i<$neededtds;$i++){

        echo "<td></td>\n";

    }

  echo "</tr></table>";

    }else {

echo "</tr>\n</table>\n";

}

 

I get: (edited down)

 

 

90

Total

10000033

1

91

mrdeeznutz

10000034

1

92

Total

10000034

1

93

sexychanels.com

10000035

1

94

Total

10000035

1

95

Glamour Angels

10000036

1

96

Total

10000036

1

97

Total

-

1

 

 

Wow, that was a pain in the arse :) Ok, so now, WHY oh why is my last total column NOT totalling my last row?

 

Thanks for the help!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.