aeris130 Posted May 29, 2007 Share Posted May 29, 2007 Suppose I have a field in a column (attributes) that looks like this: pageclass_sfx= back_button= item_title=1 link_titles= introtext=1 section=0 section_link=0 category=0 category_link=0 rating= author= createdate= modifydate= pdf= print= email= keyref= How can I use php to retrieve the value from a single line inside the field, given that there's a value stored at the end of the line (after '=')? Are there any tutorials that deal with this specifically? Quote Link to comment https://forums.phpfreaks.com/topic/53452-solved-retrieve-single-line-from-mysql-field/ Share on other sites More sharing options...
per1os Posted May 29, 2007 Share Posted May 29, 2007 <?php $array = split("=", $attributes); for ($i=0; $i<(count($array)-1); $i++) { $newArray[$array[$i]] = $array[($i+1)]; $i++; } echo 'First element is ' . $newArray['pageclass_sfx'] . '<br />'; ?> Something like that? Quote Link to comment https://forums.phpfreaks.com/topic/53452-solved-retrieve-single-line-from-mysql-field/#findComment-264140 Share on other sites More sharing options...
aeris130 Posted May 29, 2007 Author Share Posted May 29, 2007 Yeah, that should do it. Quote Link to comment https://forums.phpfreaks.com/topic/53452-solved-retrieve-single-line-from-mysql-field/#findComment-264144 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.