Codes here !

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 10
Joined: Mon Aug 13, 2012 5:11 pm

Thu Aug 23, 2012 6:55 am

What is wrong with this syntax?

Code: Select all

$log="UPDATE log SET logouttime='$time' WHERE username='$_SESSION['username']'";

User avatar
php-forum Fan User
php-forum Fan User
Posts: 979
Joined: Thu Feb 17, 2011 6:52 am
Location: Racine, WI

Thu Aug 23, 2012 7:58 am

Really you should escape out of the string when dealing with PHP variables. In this case the single quotes in your session variable are ending the quote surrounding it prematurely.

Code: Select all

$log="UPDATE log SET logouttime='" . $time . "' WHERE username='" . $_SESSION['username'] . "'";

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests