Person Posted May 24, 2007 Share Posted May 24, 2007 <?php $host = ""; $user = ""; $pass = ""; $dbname = ""; $con = mysql_connect($host,$user,$pass) or die (mysql_errno().": ".mysql_error()."<BR>"); mysql_select_db($dbname); $yesterday = date('20ymd', mktime(0, 0, 0, date("m") , date("d") - 1, date("Y"))); $query = 'SELECT' . ' user,' . ' sum(imps) AS imps,' . ' sum(clicks) AS clicks,' . ' sum(clientrev) AS clientrev' . ' FROM' . ' nuke_pnAffiliate_unauditedstats' . ' WHERE' . ' `date` = ' . $yesterday . ' AND ' . ' sid like \'%rpu%\' AND user IN (SELECT DISTINCT(cl) FROM rpu_sales WHERE salesman = \'ryan\')' . ' GROUP BY user' . ' ORDER BY clientrev DESC '; $result = mysql_query($query); $num_results = mysql_num_rows($result); $row = mysql_fetch_assoc($result); mysql_free_result($result); echo $row['user'] . $row['imps'] . $row['clicks'] . $row['clientrev']; ?> The accounts have differnt user names and i want to print the imps. clicks and clientrev for each user.... how would i go about doing that ? user imps clicks clientrev eflouret 28968 117 29.4699993133545 uniquelink 5585 91 20.0699996948242 affiliate2600 8808 36 9.06000018119812 thanks for the help Link to comment https://forums.phpfreaks.com/topic/52816-printing-info-for-diff-users/ Share on other sites More sharing options...
pocobueno1388 Posted May 24, 2007 Share Posted May 24, 2007 <?php $host = ""; $user = ""; $pass = ""; $dbname = ""; $con = mysql_connect($host,$user,$pass) or die (mysql_errno().": ".mysql_error()."<BR>"); mysql_select_db($dbname); $yesterday = date('20ymd', mktime(0, 0, 0, date("m") , date("d") - 1, date("Y"))); $query = 'SELECT' . ' user,' . ' sum(imps) AS imps,' . ' sum(clicks) AS clicks,' . ' sum(clientrev) AS clientrev' . ' FROM' . ' nuke_pnAffiliate_unauditedstats' . ' WHERE' . ' `date` = ' . $yesterday . ' AND ' . ' sid like \'%rpu%\' AND user IN (SELECT DISTINCT(cl) FROM rpu_sales WHERE salesman = \'ryan\')' . ' GROUP BY user' . ' ORDER BY clientrev DESC '; $result = mysql_query($query); $num_results = mysql_num_rows($result); while ($row = mysql_fetch_assoc($result)){ echo $row['user'] . $row['imps'] . $row['clicks'] . $row['clientrev'].'<br>'; } ?> Try that. Link to comment https://forums.phpfreaks.com/topic/52816-printing-info-for-diff-users/#findComment-260753 Share on other sites More sharing options...
Person Posted May 24, 2007 Author Share Posted May 24, 2007 nice that works... but how would i print those figures into a table? this is how it prints : eflouret2589211629.2400002479553<br>mmblogpire909410526.4599993228912<br>uniquelink51337716.9799995422363<br>fosfor5327408.81999969482422<br>Darla3730316.84000015258789<br>jennklee1871295.48000001907349<br>stanzapub5435295.4799998998642<br>affiliate26006007215.28999996185303<br>anthroa25247244.52999997138977<br>iepurilah69582.01999998092651<br>lancelhoff7186101.88999998569489<br>10zenmonkeys420471.32000005245209<br>wildbluffmedia1198861.12999999523163<br>garrigus34651.09999999403954<br>emom73410.189999997615814<br>vwizard300<br>geeksaresexy636800<br>netceo1400<br>maloosh300<br>capablenetworks101900<br>mynetwork248800<br>qweszx200<br> Link to comment https://forums.phpfreaks.com/topic/52816-printing-info-for-diff-users/#findComment-260767 Share on other sites More sharing options...
pocobueno1388 Posted May 24, 2007 Share Posted May 24, 2007 An HTML table? <?php $host = ""; $user = ""; $pass = ""; $dbname = ""; $con = mysql_connect($host,$user,$pass) or die (mysql_errno().": ".mysql_error()."<BR>"); mysql_select_db($dbname); $yesterday = date('20ymd', mktime(0, 0, 0, date("m") , date("d") - 1, date("Y"))); $query = 'SELECT' . ' user,' . ' sum(imps) AS imps,' . ' sum(clicks) AS clicks,' . ' sum(clientrev) AS clientrev' . ' FROM' . ' nuke_pnAffiliate_unauditedstats' . ' WHERE' . ' `date` = ' . $yesterday . ' AND ' . ' sid like \'%rpu%\' AND user IN (SELECT DISTINCT(cl) FROM rpu_sales WHERE salesman = \'ryan\')' . ' GROUP BY user' . ' ORDER BY clientrev DESC '; $result = mysql_query($query); $num_results = mysql_num_rows($result); print "<table border=1>"; while ($row = mysql_fetch_assoc($result)){ echo " <td>".$row['user']."</td> <td>".$row['imps']."</td> <td>".$row['clicks']."</td> <td>".$row['clientrev']."</td> <tr>"; } print "</table>"; ?> Link to comment https://forums.phpfreaks.com/topic/52816-printing-info-for-diff-users/#findComment-260806 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.