popmotsy Posted April 3, 2009 Share Posted April 3, 2009 hi to all....every time in foreach loop i got that message::Invalid argument supplied for foreach() in C:\wamp\www\cpv\user\view_report.php on line 208..... and the code is;; if(isset($_POST['submit12'])) { //echo "qqq"; //print_r ("...".$_POST['score']."..."); $score=$_POST['score']; //count($score); foreach ($score as $row=>$name) { //$custmername= mysql_real_escape_string($name); $sc=mysql_real_escape_string($name); //echo "sss"; //$scr=$_POST['score']; $sql="insert into cpv_feedback set score='$sc'"; //print_r($sql); $res=mysql_query($sql)or die(mysql_error()); } } if($res) { echo " Your Data Has Been Updated Successfully";?> <?php } ?> can any one suggest me the solution for this warning message....thanks... ??? Link to comment https://forums.phpfreaks.com/topic/152348-problame-in-foreach-loop/ Share on other sites More sharing options...
genericnumber1 Posted April 3, 2009 Share Posted April 3, 2009 $score must not be an array, which means $_POST['score'] is not an array. Link to comment https://forums.phpfreaks.com/topic/152348-problame-in-foreach-loop/#findComment-800105 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.