有人能告訴我什麼是錯誤的我的sql查詢sintax?Mysql查詢語法問題
也有任何方式在MySQL中獲取查詢的確切錯誤?
<?php
// If the constant _JEXEC is not defined, quit now.
// This stops this script from running outside of the system.
defined('_JEXEC') or die('Restricted access');
?>
<script type="text/javascript" language="javascript">
function proceed()
{
check = document.getElementById('checkToProceed');
proceedButton = document.getElementById('proceedButton');
if (check.checked)
{
proceedButton.disabled = false;
}
else
{
proceedButton.disabled = true;
}
}
</script>
<?php
if ($_POST['proceedButton'] != '') {
$user = JFactory::getUser();
$id = $user->get('id');
$name = $user->get('name');
$username = $user->get('username');
$department = $user->get('department');
$vardate = date("m/d/y : H:i:s", time());
$acknowledge = 1;
$courseTitle = $mainframe->getPageTitle();
/***************************************/
$db = &JFactory::getDBO();
$query = "INSERT INTO `jos_jquarks_users_acknowledge`(course_name)VALUES('hello')";
$db->setQuery($query);
$db->query();
echo mysql_error();
if($db->getErrorNum()) {
JError::raiseError(500, $db->stderr());
}
}
?>
<form name="quiz_info" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="checkbox" id="checkToProceed" name="checkToProceed" onclick="proceed();" />
<label for="checkToProceed">
<?php echo JText::_('I have Read and Acknowledge the procedure'); ?>
</label>
<input id="proceedButton" name="proceedButton" disabled="true" value="Acknowledge" type="submit" />
<input type="hidden" name="layout" value="default" /> <?php echo JHTML::_('form.token'); ?>
</form>
您有字段名稱'timestamp'嗎?更改該名稱或在其周圍使用bacticks。 –
我想插入執行插入的實際時間。這是正確的方式來聲明一個變量來得到這個嗎? – Tony77
這很好,是的。關注的是該字段的名稱'時間戳' - 他擔心它可能是保留字。實際上,它不是:http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html –