我不断从这个简单的
mysql语句中得到以下错误,我不明白为什么.我确定它显而易见的东西.
require_once("connect.PHP"); $query = MysqL_query("SELECT * FROM accounts ORDER BY id DESC LIMIT 1"); $row = MysqL_fetch_assoc($query); $balanceold = $row['balance']; $difference = $_POST['predec'].".".$_POST['dec']; $category = $_POST['category']; $notes = $_POST['notes']; if(isset($_POST['in'])){ $balancenew = $balanceold + $difference; $query = MysqL_query("INSERT INTO accounts(currentbalance,balancein,category,notes) VALUES (".$balancenew.",".$difference.",".$category.",".$notes.")"); if($query){ header("Location: budget.PHP"); } else{ die(MysqL_error()); } }
给出错误:
“字段列表”中的未知列“发薪日”
这是我的表单代码:
<form action=process.PHP method=post> £ <input type=text name=predec size=7> . <input type=text name=dec size=4 value=00> <br /> <select name=category> <option value=payday>Payday</option> </select> <input type=text name=notes size=20> <input type=submit name=in value=Deposit> <input type=submit name=out value=Withdraw> </form>
数据库表“accounts”包含以下字段:
id,int primary A_I
balancein,十进制10,2
平衡,2
当前余额,2
category,varchar 50
notes,varchar 255
日期,时间戳
…以该顺序