Skip to content

Get mysql table field names in ZF2

I want to store the csv data dynamically into mysql table. According to my csv columns header i want to insert the data into respective columns in mysql table. For this, I need to get all the table fields name from Zend Framework Controller or Model. I have tried with: ** ** But, it shows the error: Fatal err…

Preg_match identifier

I want ot get a match from my identifier. I have a string like this coming in {/describe:foo} where I am trying to match {/describe:} to return foo, but am not getting the regex right, would someone …

Mysql timestamps and php date()

The mysql timestamp is in a standard format 2013-02-20 02:25:21, when I use date(‘H:i:s’,$date) I get the same invalid output 18:33:33, how can I get the right output? hour:minute:seconds Answer Tip : try with MYSQL DATE_FORMAT function if you want to do it only with PHP then use strtotime

Summing over multiple fields in Laravel

I’m wondering if it is possible to take the sum of multiple fields in one query using the fluent query builder. I currently have two tables: events and attendees. Attendees belong to events and have two fields: total_raised and total_hours. What I want to do is select all events and the total amount rai…