- 'process' is a method for prepared statement
- 'QId' & 'UnqId' are the child foreign keys (just a index)
i want to make it one line statement (including 3 queries) of mysql using subquery or etc
$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'));
}