cakephp style coding would be to not grab data from your db using php
mysql functions in a view helper...I'd recommend reading up on the
manual and some basic tutorials about cake, mvc, etc.

On May 18, 9:13 am, Enchy <[EMAIL PROTECTED]> wrote:
> Thanks
>
> i endend up creating a  really quick and dirty helper
>
>  function _gettotal ($oid)
>     {
>
> $total = '';
> $sql = "SELECT price,quantity FROM Orderitems where oid='$oid'";
>
> $rst= mysql_query($sql) or die("$sql".mysql_error());
>
> while($row = mysql_fetch_array($rst))
> {
>
> $total += $row['quantity']*$row['price'];
>
> }
>
> //$total = $this->Orderitems->findBySql("SELECT SUM(price) as total
> FROM Orderitems where oid='$oid' ");
>
> return $total;
>
> }
>
> Can someone help me tidy it up with cakephp style coding please.
> that uncommented line does not work.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to