Skip to content

SplFileObject + LimitIterator + offset

I have data file with two lines (two lines just for my example, in real, that file can contain millions of lines) and I use SplFileObject and LimitIterator with offseting. But this combination have strange behaviour in some cases: Output is: 01 But with $offset set to 1, output is blank (foreach doesn’t…

Yii2 : how to cache active data provider?

In my PostSearch model I have this code : my try, instead of above line return $dataProvider, would be this block of code: I would like to cache the result returned by ADP, based on the updated_at field. I mean I want to serve data from cache until some change is made. My code does not work, I mean caching

Count results rows

I have results like that:All results And from results is Ranking list query: $results = $mysqli->query(” SELECT tv.*, (@rn := @rn + 1) as ranking FROM (SELECT liige_v.liige_id, …

Import CSV file to Postgre

I’m writing some PHP code to import a CSV file to a Postgre DB, and I’m getting the error below. Can you help me? Warning: pg_end_copy(): Query failed: ERROR: literal newline found in data HINT: Use “n” to represent newline. CONTEXT: COPY t_translation, line 2 in C:xampphtdocsimporting…