未定義指數我有郵寄到數據庫發送錯誤使用文本數據中的錯誤「注意:UNDEFINED INDEX ON LINE」PHP-MySQL的:李羣
我怎樣才能解決這個問題?
這是我的代碼:
<?php
error_reporting(0);
$con = mysql_connect("localhost","root","");
mysql_select_db("hello", $con);
$result = mysql_query("SELECT Max(id) as id from `aoa` WHERE 1");
$row = mysql_fetch_array($result);
{
echo $row['id'];
}
if($v=="")
{
$v=1000;
}
$v=$row['id'];
$v=$v+1;
$id=$v;
$sql="INSERT INTO aoa(id,name,clss)
VALUES
('$id','$_POST[name]','$_POST[clss]')";
var_dump($sql);
if (!mysql_query($sql,$con))
{
die('Data InsertionError: ' . mysql_error());
}
echo "Successfully Registered";
mysql_close($con);
?>
(這是我的錯誤文件)
Notice: C:\wamp\www\Register.php line 31 - Undefined index: clss Notice: C:\wamp\www\Register.php line 31 - Undefined index: name Notice: C:\wamp\www\Register.php line 17 - Undefined variable: v
嘿,看看 - SQL注入!泄露的數據庫連接! – 2009-11-30 10:12:02
您可以發表您的表格代碼請 – 2009-11-30 10:13:24
[PHP:「Notice:Undefined variable」和「Notice:Undefined index」]的可能重複(http://stackoverflow.com/questions/4261133/php-notice-undefined-variable-和-notice-undefined-index) – 2012-12-25 11:04:36