I need to remove "from products where id = 153183". The id can change and so I need to use a preg_replace to remove everything after the word "from" and then possibly use str_replace to remove from. I have the below but this will only remove the word from if its last in a string. Can anyone suggest what I need to add?
//doesn't work
$str = "select id, productdescription, category, price, code, manufacturer, categoryid from products where id = 153183";
$new_str = preg_replace('/from$/', '', $str);
FROMclause, notWHEREonly?