mjnmixael Posted November 20, 2009 Share Posted November 20, 2009 I need to set the value to "a:1:{s:10:"subscriber";b:1;}" for input into mysql. $capa = "a:1:{s:10:"subscriber";b:1;}" gives me an error because of the quotes within the text. Is there a way to set the value of $capa to that text exactly, ignoring all quotes and markers? Link to comment https://forums.phpfreaks.com/topic/182341-ignore-quotes-in-value/ Share on other sites More sharing options...
GingerRobot Posted November 20, 2009 Share Posted November 20, 2009 Using MySQL? Use mysql_real_escape_string Link to comment https://forums.phpfreaks.com/topic/182341-ignore-quotes-in-value/#findComment-962229 Share on other sites More sharing options...
mjnmixael Posted November 20, 2009 Author Share Posted November 20, 2009 in php. php will eventually output that data into a mysql database, but i need $capa = a:1:{s:10:"subscriber";b:1;} simply to store the data until i'm ready to insert it. Link to comment https://forums.phpfreaks.com/topic/182341-ignore-quotes-in-value/#findComment-962230 Share on other sites More sharing options...
Alex Posted November 20, 2009 Share Posted November 20, 2009 Escape the quotes or use single quotes $capa = "a:1:{s:10:\"subscriber\";b:1;}"; // or $capa = 'a:1:{s:10:"subscriber";b:1;}'; Link to comment https://forums.phpfreaks.com/topic/182341-ignore-quotes-in-value/#findComment-962235 Share on other sites More sharing options...
Mchl Posted November 20, 2009 Share Posted November 20, 2009 $capaArr = array("subscriber" => true); $capa = serialize($capaArr); echo $capa; Link to comment https://forums.phpfreaks.com/topic/182341-ignore-quotes-in-value/#findComment-962238 Share on other sites More sharing options...
mjnmixael Posted November 20, 2009 Author Share Posted November 20, 2009 Thank you, that worked. Link to comment https://forums.phpfreaks.com/topic/182341-ignore-quotes-in-value/#findComment-962239 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.