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̵…
Values inserted into database show weird characters
I am taking data in an xml feed from readability and inserting it into a database and then outputting it. The charset of the xml feed is UTF-8, my html page headers are also UTF-8. I even saved the …
PHP constructor take in one array instead of multiple params [closed]
Is it a good idea to have all class constructors take in a single array of params, instead of multiple params? For example, class A { private $id; private $name; public function …
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…
Symfony how to return all logged in Active Users
I want to return all Logged in users of my application and render it in my Dashboard. The user_id and user_name should be retrieved from the session (I am using an external LDAP Library for …
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 …
PHP static method call with variable class name and namespaces
I’m trying to call a static method for a namespaced class from another class with the same namespace. But the other class’ name is contained in a variable : Here is the Book class : My type variable contains a valid class name here Book. This class is in the same folder, and uses the same namespac…