Jump to content

problem with updating a table in MySQL


sara.m

Recommended Posts

Hi, I am trying to create an attendance system. but i have some problems,

I have 3 fields in Database MySQL, Student ID (Stud_ID), Student Name (Stud_name) and Attendance (Attendance).

I want to retrieve the Student ID and Student name from the database, and update the Attendance for each student,

the attendance is checkbox. then submit through a botton.

here is my code, but it does not make the Query,

I would appreciate if you could help me.

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/111761-problem-with-updating-a-table-in-mysql/
Share on other sites

ok so i dont get lines 34+ on page1 but line 24 says

      <td><input type="checkbox" name = "attend[]" value="yes"></td>

i would put this as

      <td><input type="checkbox" name = "attend[]" value="<?=$data['Stud_ID']?>"></td>

then you have id numbers being submitted to page100.

i dont get most of page100 i guess you have taken a lot of your code out?

but if you change

foreach($viewList as $atta){

to

foreach($POST['attend'] as $ID){

then change your query to:

$query = "update students set
	  			Attendance=1
				where Stud_ID= $ID";

change Attendance=1 to what ever you want Attendance to say if they are here.

 

Scott.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.