Note that there are some explanatory texts on larger screens.

plurals
  1. POProblems updating mySQL DB
    text
    copied!<p>Okay, so I have successfully retrieved rows from my db where i have fields : </p> <pre><code>ref,fname,lname,event1,event2,event3. ref is the ID (autonumber). </code></pre> <p>So in my index php file I retrieve the data from my db and store in a table with appropiate headers and then the 100 names approx I have. For event 1 event 2 and event 3 rows i have checkboxes. Now , I've tried for hours to capture the checked checkboxes and update the db record columns for event1 and/or event2 and/or event3. I think my error is when i name the checkboxes, I named for each row: </p> <p>The event1 checkbox I named <code>event1[]</code><br> The event2 checkbox I named <code>event2[]</code><br> The event3 checkbox I named <code>event3[]</code><br></p> <p>...and this was repeated a 100 times. When I submit the form, I wrote in the post_submit.php file the following:</p> <pre><code>$event1[] = $_POST['event1']; $event2[] = $_POST['event2']; $event3[] = $_POST['event3']; </code></pre> <p>Which is apparently wrong as it doesn't work.</p> <p>What happens is, when i check some checkboxes and then submit the form, it's always the first couple of records in my db that gets updated, if i check the LAST checkbox for event1, and i go to my database and it was only the event1 field for the first record which got updated. I'm doing something wrong here, and i'm guessing it's something to do with the information I have provided above. Can somebody please help. Also, for the checkbox value i have "1" so the idea is to update the event1,2,3 fields with a 1 if it was checked.</p> <p>Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload