1
我正在更新我使用硬編碼日期從使用常量從配置文件中使用的腳本。這是工作好,直到我得到了以下一點。單引號裏面雙引號php
原:
function getDestroyedRelationships($relation){
$owner_user_id = $_REQUEST['owner_user_id'];
$tableName = "";
if($relation=="friends"){
$tableName = "yst_twitter_following_relationships";
}else if($relation=="followers"){
$tableName = "yst_twitter_follower_relationships";
}else{
return false;
}
$twitters = NULL;
$stmt = ulPdoDb::Prepare('log', 'SELECT your_id FROM '.$tableName.' WHERE my_id=? AND updated_on<(SELECT MAX(updated_on) FROM '.$tableName.' WHERE my_id=?)');
if (!ulPdoDb::BindExec(
$stmt,
array( // output
&$twitters, 'lob'
),
array( // input
&$owner_user_id, 'int',
&$owner_user_id, 'int'
)
))
{
ul_db_fail();
return false;
}
if ($twitters = $stmt->fetchAll(PDO::FETCH_COLUMN))
{
return $twitters;
}
else
{
//echo "Nothing";
}
return $twitters;
}
正如你可以在上面看到的$表名具有表前綴「YST」定義。我想改變「YST」閱讀:執行此操作時
'.TABLE_PREFIX'
不過,我得到以下錯誤:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''.TABLE_PREFIX.'_twitter_following_relationships (my_id, your_id, created_on, up'
我懷疑這是用單引號是旁邊做雙引號?
有什麼建議嗎? 感謝
這是完美的!謝謝。我不確定它應該如何處理報價等......非常感謝 – BHWD