[英]SQL INSERT code PHP
I have been very confused on what is wrong with this php code, it only gives me blank pages. 我一直很困惑这个php代码有什么问题,它只给我空白页。
$sql = "INSERT INTO `mosys`.`allcheck`
(`cDate`,
`cCheckNo`,
`cClass`,
`cPayee`,
`cPayeeAddress`,
`cSender`,
`cSenderAddress`,
`cAmount`)
VALUES (".getDateTime()."',
'$_POST[cCheckNo]',
'$_POST[cClass]',
'$_POST[cPayee]',
'$_GET[cPayeeAddress]',
'$_POST[cSender]',
'$_POST[cSenderAddress]',
'$_POST[cAmount]');";
}
if (!mysqli_query($con,$sql))
{
die('Error: ' . mysqli_error($con));
}
}
What seems to be wrong? 怎么了?
In your PHP Code is just one output declared: die(); 在您的PHP代码中仅声明了一个输出:die(); So when there is no error, i think your code works well. 因此,当没有错误时,我认为您的代码运行良好。 Why are you expecting something else then a blank page? 为什么要期待别的空白页?
Please try this: 请尝试以下方法:
$sql = "INSERT INTO mosys.allcheck
(cDate,
cCheckNo,
cClass,
cPayee,
cPayeeAddress,
cSender,
cSenderAddress,
cAmount)
VALUES ('".getDateTime()."',
'".$_POST[cCheckNo]."',
'".$_POST[cClass]."',
'".$_POST[cPayee]."',
'".$_GET[cPayeeAddress]."',
'".$_POST[cSender]."',
'".$_POST[cSenderAddress]."',
'".$_POST[cAmount]."')";
}
if (!mysqli_query($con,$sql))
{
die('Error: ' . mysqli_error($con));
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.