我想把這個查詢轉換爲PDO:請人誰可以幫助將不勝感激如何將更新查詢從mysql轉換爲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();
}
}
?>
難道你不問[這個問題](http://stackoverflow.com/questions/15093251/how-to-change-an-update-query-from-mysql-to- pdo)已經有將近十幾次了? – 2013-03-02 11:05:15
@YourCommonSense沒有更新,我問你一個我永遠不會回答的問題。這個騙局是不被認可的,我確實連接你教我的方式。並且在我的頁面中包含了連接頁面。它可以工作,但它似乎不能在函數中訪問 – humphrey 2013-03-02 11:47:19