0
我有2個數據庫表INSERT/UPDATE Mysql的單表
TBL1用戶---------- tbl2的gamesystems
uid字段------------ - gs_uid場
2代表由USER_ID綁在一起..
現在我想tbl2的只更新能力,當他們更新有場不需要..與gs_uid除外系統。
我唯一的問題是我需要插入user_id到gs_uid。
function game_system()
{
if(isset($_POST['game_system'])) {
$user_id = $_SESSION['uid'];
$motherboard = escape($_POST['motherboard']);
$processor = escape($_POST['processor']);
$memory = escape($_POST['memory']);
$graphics = escape($_POST['graphics']);
$harddrive = escape($_POST['harddrive']);
$power = escape($_POST['powersupply']);
$cooling = escape($_POST['cooling']);
$towercase = escape($_POST['towercase']);
$sql = "INSERT INTO gamesystem(gs_uid, motherboard, processor, memory, graphics, harddrive, powersupply, cooling, towercase) ";
$sql .= "VALUES('{$user_id}','{$motherboard}','{$processor}','{$memory}','{$graphics}','{$harddrive}','{$power}','{$cooling}','{$towercase}') ";
$result = query($sql);
}
}
你已經把條件編輯請求是不是更新查詢其他插入查詢。 – Bhavin