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') Link to comment https://forums.phpfreaks.com/topic/264653-query-problem/ 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))) . "'"; Link to comment https://forums.phpfreaks.com/topic/264653-query-problem/#findComment-1356358 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\'') Link to comment https://forums.phpfreaks.com/topic/264653-query-problem/#findComment-1356359 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? Link to comment https://forums.phpfreaks.com/topic/264653-query-problem/#findComment-1356363 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.