2013-07-12 121 views
-1

好吧,所以我正在嘗試使用以下代碼更新遊戲服務器數據庫的某些值。變量數量與參數數量不匹配 - MySQLi

$db1 = "versound_store"; 

//connection to the database 

$mysqli = new mysqli($hostname, $sqluser, $sqlpass, $db1); 


    if($stmt = $mysqli->prepare("UPDATE vxp_users SET tokens =?, xp =?, level =? WHERE steamid ='?'")) 
    { 
    $stmt->bind_param('isss', $tokens, $xp, $level, $steamid00); 
    $stmt->execute(); 
    $stmt->close() or trigger_error($db->error); 
    } 
    else { 
    printf("Prep statment failed: %s\n", $mysqli->error); 
    } 
$mysqli->close(); 
$db2 = "versound_stats"; 
$mysqli = new mysqli($hostname, $sqluser, $sqlpass, $db2); 
    if($stmt = $mysqli->prepare("UPDATE ttt_stats SET roundsplayed =?, playtime =? WHERE steamid ='?'")) 
    { 
    $stmt->bind_param('iis', $roundsplayed, $totalplaytime, $steamid00); 
    $stmt->execute(); 
    $stmt->close() or trigger_error($db->error); 
    } 
    else { 
    printf("Prep statment failed: %s\n", $mysqli->error); 
    } 
$mysqli->close(); 

當然不過,對於這兩個查詢我得到Number of variables doesn't match number of parameters in prepared statement on line 64

$令牌是一個數通常爲-50和10000之間。

$ XP是一個數通常爲-100和269000.

之間$水平是一個數通常爲1和50之間

$ roundsplayed是大於0

$ totalplaytime一個數是通常爲1和1000000

$ steamid00之間的字符串FORMATT像STEAM_0:1:23456789一樣編輯。

我在做什麼錯?

回答

0

罪魁禍首

WHERE steamid ='?'" 

不使用引號

WHERE steamid =?" 
相關問題