Monday, April 16, 2012

Removing specific text from string before entrance into MYSQL

Hi guys i have an PHP array that is coming from an rss feed with 2 sets of data. title's and descriptions.



(example print of array, i want to edit all of the description items in the array not just one index)



[2] => ('Remembrance','Release Date: Thursday 19th April 2012')


How would i manipulate the description string to remove "Release Date: " before its entrance into a mysql table?



This is my other code -
$rss = simplexml_load_file('rss.xml');
$title = $rss->xpath('//title'); //finding the title tags in the xml document and loading into variable
$description = $rss->xpath('//description');



$rows=array();

foreach($result as $title){
$rows[]="('".mysql_real_escape_string($title)."','".mysql_real_escape_string(array_shift($description))."')";
}
mysql_query("INSERT INTO Films (Film_Name, Film_Release) VALUES ".implode(',',$rows));
print_r($rows);




No comments:

Post a Comment