我有一个问题。
$db = JFactory::getDBO();
$res2 = $_data['DateSubmitted'];
//res2 returns 2014-08-31 12:03:02
$res3 = $_data['UserIp'];
//res3 returns 109.173.20.143 for example
$resdate = date('Y-m-d H:i:s', strtotime($res2));
$SubmId = $db->query("SELECT `SubmissionId` FROM `rrr_submissions` WHERE `FormId` = '20' AND `DateSubmitted`='".$resdate."' AND `UserIp`='".$res3."'");
$db->setQuery("UPDATE `rrr_submission_values` SET `FieldValue` = '".$SubmId."' WHERE `FieldName`='7_Status' AND `SubmissionId`='5682'");
$db->query();
在rrr_submissions中:
在rrr_submission_values中:
我做错了什么?结果我看到" 1"在FieldValue。
答案 0 :(得分:1)
尝试加载结果行,然后调用字段值。
$db = JFactory::getDBO();
$res2 = $_data['DateSubmitted'];
//res2 returns 2014-08-31 12:03:02
$res3 = $_data['UserIp'];
//res3 returns 109.173.20.143 for example
$resdate = date('Y-m-d H:i:s', strtotime($_data['DateSubmitted']));
$SubmId = $db->query("SELECT `SubmissionId` FROM `rrr_submissions` WHERE `FormId` = '20' AND `DateSubmitted`='".$resdate."' AND `UserIp`='".$res3."'");
$row = $db->loadRow();
$SubmId = $row['SubmissionId'];
$db->setQuery("UPDATE `rrr_submission_values` SET `FieldValue` = '".$SubmId."' WHERE `FieldName`='7_Status' AND `SubmissionId`='5682'");
$db->query();