Jump to content

[SOLVED] Comma Seperated Values in Update form


Zergman

Recommended Posts

I have a simple form that has a list with 4 values in it.  Its set to multiple as I want to allow for more than 1 selection.

 

Problem is im getting a syntax error when submitting the form.

 

Here's the code for the comma seperated part

 

$access = $_GET['access'];

if (isset($_GET['access'])) {
    $comma_separated = "'" . implode("','", $access) . "'";
} else {
    $comma_separated = "'vsuser','vsadmin','nsuser','nsadmin'"; 
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
  $updateSQL = sprintf("UPDATE user_logins SET user_name=%s, password=%s, email=%s, 'access' IN ($comma_separated), first_name=%s, last_name=%s, theme=%s, layout=%s, status=%s, `group`=%s WHERE id=%s",
                       GetSQLValueString($_POST['user_name'], "text"),
                       GetSQLValueString($_POST['password'], "text"),
                       GetSQLValueString($_POST['email'], "text"),
                       GetSQLValueString($_POST['first_name'], "text"),
                       GetSQLValueString($_POST['last_name'], "text"),
                       GetSQLValueString($_POST['theme'], "text"),
                       GetSQLValueString($_POST['layout'], "text"),
                       GetSQLValueString($_POST['status'], "text"),
                       GetSQLValueString($_POST['group'], "text"),
                       GetSQLValueString($_POST['id'], "int"));

 

Not sure what im doing wrong

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.