Gossamer Forum
Home : General : Internet Technologies :

Re: [Unquick] Another PHP question functions and arrays

Quote Reply
Re: [Unquick] Another PHP question functions and arrays In reply to
Hi there,

I'm not entirely sure what you're trying to accomplish, but what if you try something like the following. (Also, there might be more efficient ways to accomplish this, but I tried to keep the basic approach consistent.) Anyway:

Code:


function QUICK_STATS_QUERY()
{
$query1 = "SELECT count(user_expirydate) FROM users WHERE user_expirydate >= curdate()";
$query2 = "SELECT count(user_expirydate) FROM users WHERE user_expirydate < curdate()";
$query_array = array($query1, $query2);

for($i=0; $i <= 1; $i++){
$infoquery_results = mysql_query($query_array[$i]) or die('MySQL query infoquery failed. Error if any: ' . mysql_error());
$active_details[$i] = mysql_result($infoquery_results,0,0);
}

return $active_details;
}




CURRENT_DATE();
$quick_stats_values = QUICK_STATS_QUERY();

print <<<END
<table border="0" width="100%">
<tr>
<td width="30%" valign="top"><b>Quick Totals:<br>
</b>Active Accounts: $quick_stats_values[0]<br>
Expired Accounts: $quick_stats_values[1]<br>
Suspended Accounts: 000
<p><b>Last 7 days:<br>
</b>New Accounts: 000<br>
Renewed Accounts: 000<br>
Expired Accounts: 000</p>
</td>
<td width="50%" valign="top">
<h3>Administration Panel</h3>
</td>
</tr>
</table>
END;

Fractured Atlas :: Liberate the Artist
Services: Healthcare, Fiscal Sponsorship, Marketing, Education, The Emerging Artists Fund
Subject Author Views Date
Thread Another PHP question functions and arrays Unquick 3737 Jun 14, 2003, 10:16 AM
Post Re: [Unquick] Another PHP question functions and arrays
hennagaijin 3465 Jun 15, 2003, 5:42 AM