Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.