在我的表单由ajax和表单验证(jquery.validationEngine)提交后,我正在尝试获取一个值(mysql_insert_id),但没有成功..
$(document).ready(function()
{
$("#form1").validationEngine('attach',
{
autoHidePrompt:true,showOneMessage:true,
onValidationComplete: function(form, status)
{
if(status === true)
{
formget(document.getElementById('form1'),'page.php');
TINY.box.show({html:'The entry (i want the id here..) has been updated successfully!',animate:false,close:false,mask:false,boxid:'success',autohide:2,top:5});
}
else
{
TINY.box.show({html:'Please check the form and try again',animate:false,close:false,mask:false,boxid:'error',autohide:2,top:5});
}
}
});
我的page.php文件
$query="INSERT INTO users (userid,title,)VALUES ('".$_SESSION['id']."', '".$_REQUEST['title']."')"; $result=mysql_query($query);
$id = mysql_insert_id();
答案 0 :(得分:0)
$query="INSERT INTO users (userid,title,)VALUES ('".$_SESSION['id']."', '".$_REQUEST['title']."')"; $result=mysql_query($query);
$id = mysql_insert_id();
echo mysql_error();
查看错误消息;