- 'process' 是准备好的语句的方法
- 'QId' & 'UnqId' 是子外键(只是一个索引)
我想使用子查询等使其成为mysql 的一行语句(包括 3 个查询)
$get = $call->process("SELECT UnqId FROM table1
WHERE QId = ? AND UnqId = ?",
array($_SESSION['Q'], $_SESSION['U']));
if($get) //if table exists
{
$call->process("UPDATE table1 SET col3 = ?, col4 = UTC_TIMESTAMP()
WHERE QId = ? AND UnqId = ?",
array('OK', $_SESSION['Q'], $_SESSION['U']));
}
else
{
$call->process("INSERT INTO table1 VALUES (?, ?, ?, UTC_TIMESTAMP(),
NULL, NULL, NULL, NULL)",
array($_SESSION['Q'], $_SESSION['U'], 'OK'));
}