我想将此查询转换为 pdo :请任何可以提供帮助的人都将不胜感激
function updateonlinesession(){
if(isset($_SESSION['username']['id'])){
$uid = $_SESSION['username']['id'];
$page = $_SERVER['REQUEST_URI'];
$ip = $_SERVER['REMOTE_ADDR'];
$username = $_SESSION['logged'];
("UPDATE site_user SET dateupdated = now(),ip = '$ip' WHERE
username = '".mysql_real_escape_string($_SESSION['username'])."'");
}
}
This is What I have tried
<?php
function updateonlinesession(){
if(isset($_SESSION['username']['id'])){
$uid = $_SESSION['username']['id'];
$page = $_SERVER['REQUEST_URI'];
$ip = $_SERVER['REMOTE_ADDR'];
$username = $_SESSION['logged'];
$update =("UPDATE site_user SET dateupdated = now(),ip = '$ip' WHERE
username = '"($_SESSION['username'])."'");
$updated_once= $con->($update);
$updated_once->execute();
}
}
?>