gammaman Posted April 27, 2008 Share Posted April 27, 2008 I know this will seem like a double post but I am very close. This code receives user input information from text boxes for a specific field in which specific rows of that field have no information and stores them into an array. Now when I do my query to put that user information into the field, it puts element zero into all of the rows that have no information. I want it to put element zero in the first record with a field with no information, and the element one into the next record with a field with no information, and so on. session_start(); $_SESSION['admin']['admins']; echo "{$_SESSION['admin']['admins']}"; $_SESSION['admin']['adminpass']; $_SESSION['checkaddGrades']['stuid']; $Grade = ($_POST['grd']); print_r($Grade); $result=mysql_query("select CourseID,CourseName,Grade From Rcourse WHERE StudentID='{$_SESSION['checkaddGrades']['stuid']}'"); $cou=mysql_num_rows($result); echo $cou; while ($row=mysql_fetch_array($result)) { //$CourseID= $row['CourseID']; //$grade = $row['Grade']; //$Course=$row['CourseName']; foreach ($Grade as $itm){ mysql_query("Update Rcourse set Grade = '$itm' where Grade < 'A' AND StudentID='{$_SESSION['checkaddGrades']['stuid']}'") or die(mysql_error()); } } } Link to comment https://forums.phpfreaks.com/topic/103153-help-getting-array-values-i-am-almost-there/ Share on other sites More sharing options...
woobarb Posted April 27, 2008 Share Posted April 27, 2008 your query doesn't use a where, also maybe $_SESSION['checkaddGrades']['stuid'] needs incrementing (but not sure there!) Link to comment https://forums.phpfreaks.com/topic/103153-help-getting-array-values-i-am-almost-there/#findComment-528439 Share on other sites More sharing options...
gammaman Posted April 27, 2008 Author Share Posted April 27, 2008 The query that is enclosed in the foreach loop does use a where. Link to comment https://forums.phpfreaks.com/topic/103153-help-getting-array-values-i-am-almost-there/#findComment-528444 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.