I've searched and tried all sorts of code to get a variable from a php array.
I can display the data from the DB:
- a:2:{s:5:"entry";a:1:{s:4:"type";s:10:"individual";}s:5:"image";a:3:{s:6:"linked";b:1;s:7:"display";b:1;s:4:"name";a:4:{s:9:"thumbnail";s:27:"AT_Action_web_thumbnail.jpg";s:5:"entry";s:23:"AT_Action_web_entry.jpg";s:7:"profile";s:25:"AT_Action_web_profile.jpg";s:8:"original";s:26:"AT_Action_web_original.jpg";}}}
I used this code:
$var = htmlentities(print_r(unserialize($options),True))
To get this:
Array ( [entry] => Array ( [type] => individual ) [image] => Array ( [linked] => 1 [display] => 1 [name] => Array ( [thumbnail] => a1mattbaisley1_thumbnail.jpg [entry] => a1mattbaisley1_entry.jpg [profile] => a1mattbaisley1_profile.jpg [original] => a1mattbaisley1_original.jpg ) ) )
I've tried looping through it and selecting a specific key and it never works.
Current testing code:
while ($var = mysql_fetch_array($result,MYSQL_ASSOC)) {
$data[] = $row;
}
for ($i = 0; $i < $num_rows; $i++) {
$id = mysql_result($result,$i,"id");
$title = mysql_result($result,$i,"title");
$first = mysql_result($result,$i,"first_name");
$last = mysql_result($result,$i,"last_name");
$options = mysql_result($result,$i,"options");
/////////////////////////////////////
//$var = unserialize(urldecode($options));
$var = htmlentities(print_r(unserialize($options),True));
echo "$first $title $last<br><br>VAR:$var<br><br>VAR2:$options<br><br>THUMBNAIL:$thumb<br><br><hr><br><br>\n";
} ?>
My goal is to just grab one or two from the array. I have limited PHP knowledge and trying to setup something simple for a friend. Thanks!