I am new for php. I don't know.... what to do? but i try to get data using "foreach($data as $key => $value), but i got error message "Warning: Invalid argument supplied for foreach()"
my code is below
Expand|Select|Wrap|Line Numbers
- $query = "SELECT meta_aps FROM sgc where nric = 'S9214548D'";
- $result = mysql_query($query) or die (mysql_error());
- $num = mysql_numrows($result);
- for ($i = 0; $i < $num; $i++) {
- $extra = mysql_result($result,$i);
- $serializedData = $extra;
- $data = @unserialize($serializedData);
- foreach($data as $key => $value){
- print_r($value);
- }
- //print_r ($data);
- echo '<br>';
- }
Expand|Select|Wrap|Line Numbers
- Array ( [carer] => Soh Man was a student of (APS) from Jan 2007- Nov 2010 During her time in school, Soh Man managed to demonstrate care for her fellow classmates. She often took the initiative to help new students; she is a member of Boys Scout and was the class monitor. [story] => She has demonstrated her commitment and particicationable by carrying out tasks assigned to her diligently and responsibly. [other] => She adapts very well to unfamiliar environment easily. She is an honest and reliable person. )
Carer:
Soh Man was a student of (APS) from Jan 2007- Nov 2010 During her time in school, Soh Man managed to demonstrate care for her fellow classmates. She often took the initiative to help new students; she is a member of Boys Scout and was the class monitor.
Story:
She has demonstrated her commitment and particicationable by carrying out tasks assigned to her diligently and responsibly.
Others:
She adapts very well to unfamiliar environment easily. She is an honest and reliable person.