Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/68414-need-help-in-an-update-on-an-old-project/
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.