Re: Noobie starting to learn OOP for databases needs help
| From: | tamouse mailing lists | Date: | Tue, 18 Dec 2012 06:12:57 +0000 |
| Subject: | Re: Noobie starting to learn OOP for databases needs help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-319905@lists.php.net to get a copy of this message | ||
On Sun, Dec 16, 2012 at 9:38 AM, dealTek <dealtek@gmail.com> wrote:
> Noobie starting to learn oop for databases from here:
Cool. :)
> mysql_insert_id (depricated?) or mysqli_insert_id() (I am using mySql 5.3)
The mysqli version would be preferred, since you're using mysqli in that class.
> 2 - how does one do aggrigate select queries like "SELECT SUM(price) FROM mytable"
> ... what I tried seemed to fail...
Problem there is that the query method forces everything through
prepare, and you don't have a preparable statement. I'd write another
method for such single values where you won't sent it through
prepare/execute/bind, and just suck in the value and return it.