Skip to content

Tag: php

Finding duplicate column values in a CSV

I’m importing a CSV that has 3 columns, one of these columns could have duplicate records. I have 2 things to check: So far, I’m parsing the CSV file, once and checking that 1. (NAME is valid), which if it fails, it simply breaks out of the while loop and stops. I guess the question is, how I&#821…

pass a callback WITH arguments in PHP

I have a PHP library function expecting a callback with no arguments. I know I can pass an object’s method with array($this , ‘my_function_name’) but how can I give parameters to the my_function_name? I have found a solution using create_function but from PHP manual I see it has security iss…

MySQL Rows Disappearing (Mysteriously)

I have 3 tables A, B and C which are directly linked and should contain the same number of rows, the rows for each table being created together. I’ve recently noticed that after creating 1000 rows for test purposes (rows are definitely inserted, no transactions, system stable), and without any applicati…

cakephp: update hasmany related tables

For example, if we have: from http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html How should we do an update on the Comment table from the User controller given that all these data is submitted using one form? This is somehow the same as my question here: updating related tables in…

PHP cURL error code 60

Whilst trying to setup a php environment on windows (using wamp) to use the Amazon PHP SDK, when i try to run a sample test I get the following error: I have already added the following line to my php.ini which is the location of a certificate i created using this VBS script VBS-Script I have restarted my WAM…

one line if statement in php

I’d like to to some thing similar to javascripts var foo = true; foo && doSometing(); but this doesnt seem to work in php. I’m trying to add a class to a label if a condition is met …

Extract datas with ‘,’ from database to csv file

This is my code to extract datas from database to csv file. It’s working fine but now that I put it in my program where the datas have addresses, thus having commas ( , ), I’m having problem in printing it. This is how it looks like: It should be like this: The City and email are pushed to the