所以,我正在为学校做一个kalender sorta事情,我试图在表中插入多行thingys,删除功能很好但是当我尝试添加功能时它不能正常工作。这是我的代码=
<?php
$connection = new mysqli('localhost','root','','calendar');
$Days = $_POST['Day'];
$Months = $_POST['Month'];
$Years = $_POST['Year'];
$Names = $_POST['Name'];
$sql = "INSERT INTO birthdays (day), (month), (year), (person) VALUES ('$Days'), ('$Months'), ('$Years'). ('$Names')";
echo $sql;
$connection->query($sql);
//header('location:index.php');
?>
结果:
$sql = "INSERT INTO birthdays (day,month,year,person) VALUES('$Days'), ('$Months'), ('$Years'). ('$Names')";
所以它应该可以正常工作,但它并没有保存到桌面上。 我也不太了解MYSQL,我认为我在插入部分做错了,我一次做多行,但不知道如何修复它。
(嗯,他在最后一页上的dates
,Names
etc
,但效果很好)
答案 0 :(得分:0)
正确的SQL语法就是这个:
(defun matrix-mul (matrix vector dest)
"Multiply MATRIX by VECTOR putting the result into DEST.
Optimized for DOUBLE-FLOAT vectors and matrices"
(declare (type (array double-float (* *)) matrix)
(type (vector double-float *) vector dest)
(optimize (speed 3) (debug 0) (safety 0)))
(destructuring-bind (rows cols) (array-dimensions matrix)
(dotimes (i rows)
(setf (aref dest i)
(loop for j below cols sum (the double-float
(* (aref matrix i j) (aref vector j))))))))
但是你应该使用带有占位符的预准备语句,如下所示:
$sql = "INSERT INTO birthdays (day, month, year, person) VALUES ($Days, $Months, $Years, '$Names')";