Jump to content

Error in my WHERE statement


postbil.com

Recommended Posts

Hello Php Freaks

I had made a calendar with a link for each day to another page where the user can add events to the selected day. I have a table in my database for email (I use the email addresses as username) and password then I have another table for all the information to the events. Then the user log in to the site the system made a session with the login name ($_SESSION[‘loginname’]). But I have a problem with my MYSQL code:

   

    $query = 'UPDATE site_user u, site_user_private_calender SET

            date_timestamp = "' . mysql_real_escape_string($timestamp, $db) . '",

            header = "' . mysql_real_escape_string($header, $db) . '",

            start_time_timestamp = "' . mysql_real_escape_string($start_time_timestamp, $db) . '",

            end_time_timestamp = "' . mysql_real_escape_string($end_time_timestamp, $db) . '",

            location = "' . mysql_real_escape_string($location, $db) . '",

            comment = "' . mysql_real_escape_string($comment, $db) . '",

        WHERE

            email = ' . $_SESSION['loginname'];

        mysql_query($query, $db) or die(mysql_error($db));

 

I all ways get an error in my WHERE statement. Why can this be? What dose I do wrong?   

 

I hope some one can help me.!!

Postbil.com

 

Link to comment
Share on other sites

$query = 'UPDATE site_user u, site_user_private_calender SET
           date_timestamp="'.mysql_real_escape_string($timestamp, $db).'",
           header="'.mysql_real_escape_string($header, $db).'",
           start_time_timestamp="'.mysql_real_escape_string($start_time_timestamp, $db).'",
           end_time_timestamp="'.mysql_real_escape_string($end_time_timestamp, $db).'",
           location="'.mysql_real_escape_string($location, $db).'",
           comment="'.mysql_real_escape_string($comment, $db).'" WHERE email ="'.$_SESSION['loginname'].'"';

Link to comment
Share on other sites

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.