Jump to content

multiple array not updating correctly


brooksh

Recommended Posts

When I submit my form, it limits the update to 1 character. For example if I put "Description" as the description, it inserts "d" in the database. What is wrong with my code?
 

    $size = count($_POST['checkbox']);

    // start a loop in order to update each record
    $i = 0;
    while ($i < $size) {
    // define each variable
    $title2= $_POST['title'][$i];
    $description2= $description[$i];
    $edit= $_POST['checkbox'][$i];

    mysql_query("UPDATE `categories` SET `title`='$title2',`description`='$description2' WHERE id ='$edit'");
    ++$i;
    }
Link to comment
https://forums.phpfreaks.com/topic/277040-multiple-array-not-updating-correctly/
Share on other sites

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.