cuboidgraphix Posted September 7, 2007 Share Posted September 7, 2007 Hello again guys.. Thanks to you all, my first project was successful. But now I need a small alteration to the script, where by it would give me an updated output. The script is as follows: $count = 0; $amt = 0; if (($con = pg_connect("host=$HOST port=$PORT user=$USER password=$PASS dbname=$NAME")) === FALSE) { print("Connection Failed."); exit; } else { $sql = pg_query("SELECT COUNT(value) as count, SUM(value) AS total FROM donations "); if ($sql === FALSE) { print("Query Error."); exit; } else { $res = pg_fetch_assoc($sql); $count = $res['count']; $amt = $res['total']; } } echo "1st Donation: 904 Donations totaling $4520, Matched by Smart - Total is $9040.<br />"; echo "2nd Donation: There have been <u>{$count}</u> donations. You've contributed <u>\${$amt}</u> to date. Thank You!"; OK what I need is for the $count output to be the difference between the count - 904 and the $amt output be the difference between total - 4520 . Is there anyway this can be done? Thanks for all your help.. I'll keep checking for a reply. Quote Link to comment https://forums.phpfreaks.com/topic/68414-need-help-in-an-update-on-an-old-project/ Share on other sites More sharing options...
cuboidgraphix Posted September 7, 2007 Author Share Posted September 7, 2007 I also have a time factor... so can the query be written so that the output starts reading from a specific date and time? example... "20:50:55.539025" ? or would it be easier just to subtract the amount? Please help me. Quote Link to comment https://forums.phpfreaks.com/topic/68414-need-help-in-an-update-on-an-old-project/#findComment-343994 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.