我正在尝试通过一个简单的表单更新我的数据库,但由于某种原因,该表没有更新。我在 phpmyadmin 中尝试了 sql 查询,它似乎工作正常。
<?php
include("_/inc/session_handler.php");
include("_/inc/dbcon.php");
$uplform = "";
if(isset($_POST['insert'])){
$post=$_POST['wish'];
$succes="";
$succes .="<h1>SUCCES</h1>";
$insert_wish_sql="INSERT INTO wishlist(wish_id, wish, datetime)VALUES (null, '$post', CURDATE())";//insert new post
echo $succes;
}
//The form
$uplform .="<form action=\"\"method=\"post\">";
$uplform .="<input type='text' name='wish' placeholder='wish'/>";
$uplform .="<input type=\"submit\" name=\"insert\" value=\"Upload\" />";
$uplform .="</form>";
?>
我什至收到了成功消息,但表中没有任何反应。我错过了什么?
更新:我刚刚完全智障了。我忘了补充
$link = mysql_connect($host, $login, $pw);
mysql_select_db($database);
所以我基本上没有连接到数据库 8-|。非常感谢!