I am making my first app in codeigniter that draws birthdays from the facebook api and places them into a mysql database. The dates coming from the facebook api are 00-00-0000 and I need them to be converted to 0000-00-00.
I am using this bit of code to pull the data from facebook:
try{
$fql = "SELECT uid, name, birthday_date FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=me()) AND strlen(birthday_date) > 0";
$param = array(
'method' => 'fql.query',
'query' => $fql,
'callback' => ''
);
$fqlResult = $facebook->api($param);
}
catch(Exception $o){
d($o);
}
}
I am using this bit of code to put the query from the api to mysql:
this->db->insert_batch('friends_birthdays', $fqlResult);
Do I need to escape the $fqlresult string first or is there something helpful in codeigniter that will help me do this? Sorry if this sounds stupid but I am a noob and any help would be greatly appreciated.
Thanks,
Tom
You could use the date function with strtotime e.g.