Z. Zeff Z. Zeff - 2 years ago 89
PHP Question

SQL + PHP Update query

I've been trying to update my data according to the user session (UserLogin) but it kept saying: Data type mismatch in criteria expression. The

is just for testing purposes.

Thanks in advance,


function Employee1_BeforeShow(& $sender)
$Employee1_BeforeShow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $Employee1; //Compatibility

$Page = CCGetParentPage($sender);

$db = $Page->Connections["PettyCashMDB"];

$sql1 = "UPDATE Employee SET Employee.LastActive = Date() WHERE Employee.[EmpID] = ". $_SESSION['UserLogin'];


Employee1_BeforeShow @67-67106FAD
return $Employee1_BeforeShow;

EDIT: I've tried @NanaPartykar 's method and by accident I've noticed that it does get the value from
, just that somehow the datatype is different.

EDIT: It displays the error
Data type mismatch
but both of them are string and returns string.

Answer Source

Finally got it to work, this is the code $sql1 = "UPDATE Employee SET LastActive = Date() WHERE EmpID = '$_SESSION[UserLogin]' "; Thanks to everyone that helped out.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download