我有一个表单,用于向每个数据库表添加事件。
为了使数据和时间合适,我正在使用下拉菜单。但是我使用的是5 2的时间和3的日期。在Dream weaver的第二个选择语句中,它突出显示为黄色,就像我有一个错误。 http://pastebin.com/NJB84hed
我想确保这也是保存id,以便id可以在该表中发布
$results=mysqli_query($con, "select * from Users where `userName` ='$username'");
$id = 'id_cust';
答案 0 :(得分:0)
(1)您错过了}
if(isset($_POST['insert'])){
if(isset($_POST['insert'])){
$artist = $_POST['artist'];
$place = $_POST['place'];
$hour = $_POST['hour'];
$minute = $_POST['min'];
$year = $_POST['year'];
$month = $_POST['month'];
$day = $_POST['day'];
$price = $_POST['price'];
$open = $_POST['open'];
$time = $hour.':'.$minute;
$date = $year.'-'.$month.'-'.$day;
$result=mysqli_query($con,"insert into Concert values('$id','$artist','$date','$time','$place','$price','$open')");
if($result)
{
echo 'Values updated successfully';
}
?>
应该是
if(isset($_POST['insert'])){
$artist = $_POST['artist'];
$place = $_POST['place'];
$hour = $_POST['hour'];
$minute = $_POST['min'];
$year = $_POST['year'];
$month = $_POST['month'];
$day = $_POST['day'];
$price = $_POST['price'];
$open = $_POST['open'];
$time = $hour.':'.$minute;
$date = $year.'-'.$month.'-'.$day;
$result=mysqli_query($con,"insert into Concert values('$id','$artist','$date','$time','$place','$price','$open')");
if($result)
{
echo 'Values updated successfully';
}
} // MISSING THIS CLOSING BRACKET
?>
(2)在第73行,您拼错了所选的结束标记
</selct>
应该是
</select>
(3)另外,我假设
$results=mysqli_query($con, "select * from Users where `userName` ='$username'");
$id = 'id_cust';
应该是
$results=mysqli_query($con, "select * from Users where `userName` ='$username'");
$row = mysqli_fetch_array($result);
$id = $row['id_cust'];