Adding to multiplied values
Adding to multiplied values
am 19.05.2006 06:45:45 von Reed Loefgren
All
I've been hacking away on a little time billing database and I've been having
difficulty adding to a calculated amount. This is what I am trying to get
to in an insert (for the column 'grandTotal'):
($compRate * $time) + $expenses
I've tried various combinations of quotes, double quotes, parentheses and
what have you, but I still get errors like:
ERROR: operator is not unique: "unknown" + "unknown"
and
ERROR: invalid input syntax for type numeric: "7.50 * 5"
I've been able to figure out hours times comp to produce a subtotal, but I
can't seem to pull in an additional amount to produce the grand total.
What's the syntax here?
thanks,
r
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings
Re: Adding to multiplied values
am 19.05.2006 09:09:42 von Volkan YAZICI
On May 18 10:45, Reed Loefgren wrote:
> I've been hacking away on a little time billing database and I've been
> having difficulty adding to a calculated amount.
Can we see the exact PHP code stands for the execution of related query?
Regards.
---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?
http://archives.postgresql.org
Re: Adding to multiplied values
am 19.05.2006 15:13:10 von Reed Loefgren
On Fri, 19 May 2006, Volkan YAZICI wrote:
> On May 18 10:45, Reed Loefgren wrote:
>> I've been hacking away on a little time billing database and I've been
>> having difficulty adding to a calculated amount.
>
> Can we see the exact PHP code stands for the execution of related query?
>
>
> Regards.
>
>
Sure, and thanks. This query works, but I fail at tying in $totalExpenses
to create a $grandTotal. (pine is gonna butcher this...);
$query = "INSERT INTO invoices2 (idate, iperiod, inum, ijobcode,
iaccount, icomp, itime, isub, create_time) VALUES('" . $invoiceDate . "',
'" . $billingPeriod . "', '" . $invoiceNumber . "', '" . $jobCode . "', '"
.. $accountNumber . "', '" . $billingRate . "', '" . $totalHours . "', '" .
$billingRate * $totalHours . "', 'now()')";
r
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly
Re: Adding to multiplied values
am 19.05.2006 15:39:42 von Randy Moller
Well, can we see the code that's failing? There's nothing we can tell you
about code that works.....(other than it would be a bit tidier not to do
your math inside a query....)
Z-
-----Original Message-----
From: pgsql-php-owner@postgresql.org [mailto:pgsql-php-owner@postgresql.org]
On Behalf Of Reed Loefgren
Sent: Friday, May 19, 2006 7:13 AM
To: Volkan YAZICI
Cc: PHP on postgresql list server
Subject: Re: [PHP] Adding to multiplied values
On Fri, 19 May 2006, Volkan YAZICI wrote:
> On May 18 10:45, Reed Loefgren wrote:
>> I've been hacking away on a little time billing database and I've been
>> having difficulty adding to a calculated amount.
>
> Can we see the exact PHP code stands for the execution of related query?
>
>
> Regards.
>
>
Sure, and thanks. This query works, but I fail at tying in $totalExpenses
to create a $grandTotal. (pine is gonna butcher this...);
$query = "INSERT INTO invoices2 (idate, iperiod, inum, ijobcode,
iaccount, icomp, itime, isub, create_time) VALUES('" . $invoiceDate . "',
'" . $billingPeriod . "', '" . $invoiceNumber . "', '" . $jobCode . "', '"
.. $accountNumber . "', '" . $billingRate . "', '" . $totalHours . "', '" .
$billingRate * $totalHours . "', 'now()')";
r
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.6.0/342 - Release Date: 5/17/2006
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings