james182 Posted June 23, 2012 Share Posted June 23, 2012 i have a problem. $colours = implode("','", explode('-', substr_replace($colour ,"",-1))); // outputs: D','E','F "','" is getting placed in the query as "\',\'" need to change '\'E\',\'F\'' SELECT * FROM (`default_products_diamonds`) WHERE `shape` = 'Princess' AND `colour` IN ('\'D\','\'E\',\'F\'') Needs to be like this: SELECT * FROM (`default_products_diamonds`) WHERE `shape` = 'Princess' AND `colour` IN ('D','E','F') Quote Link to comment Share on other sites More sharing options...
Barand Posted June 23, 2012 Share Posted June 23, 2012 looks like you were nearly there $colours = "'" . implode("','", explode('-', substr_replace($colour ,"",-1))) . "'"; Quote Link to comment Share on other sites More sharing options...
james182 Posted June 23, 2012 Author Share Posted June 23, 2012 I have that too. but why is it adding the \' to it ??? the \' is stopping my query from working.. SELECT * FROM (`default_products_diamonds`) WHERE `shape` = 'Princess' AND `colour` IN ('\'D\',\'E\',\'F\'') Quote Link to comment Share on other sites More sharing options...
Barand Posted June 23, 2012 Share Posted June 23, 2012 Are you posting $colours to another page with magic_quotes switched on? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.