时间:2021-07-01 10:21:17 帮助过:9人阅读
Sales Rep Maintenance Successfully connected to MySQL.'; //mysql_close(); // close the connection}else { die('Could not connect to MySQL because: ' .mysql_error() . '
');}if (@mysql_select_db("PREMIERE", $connection)){ print 'The PREMIERE database has been selected.
';}else { die('Cound not select the PREMIERE database because: ' .mysql_error().'
');}if(!$_REQUEST['submit']){ generate_form();}else if($_REQUEST['submit'] == "Search"){ search_rep();}else if($_REQUEST['submit'] == "Add"){ add_rep();}else if($_REQUEST['submit'] == "Delete"){ delete_rep();}else if($_REQUEST['submit'] == "Update"){ update_rep();}function generate_form(){}function search_rep(){// Define the rep Number php variable name$rep = $_POST['rep_num'];print "The rep num chosen was $rep
";// Define the query$query = "SELECT * FROM REP WHERE CUSTOMER_NUM = '$rep'";// Output the resulting query tableif ($r = mysql_query($query)){ while ($row = mysql_fetch_array($r)) { print "{$row['REP_NUM']}
\n"; }}}function add_rep(){}function delete_rep(){}function update_rep(){}?>
{$row['LAST_NAME']}
{$row['FIRST_NAME']}
{$row['STREET']}
{$row['CITY']}
{$row['STATE']}
{$row['ZIP']}
{$row['COMMISSION']}
{$row['RATE']}
error_reporting(E_ALL & ~E_NOTICE);
改作
error_reporting(E_ALL);
可能就知道了
把 $row 的关联键改成小写看看
error_reporting(E_ALL & ~E_NOTICE);
改作
error_reporting(E_ALL);
可能就知道了
把 $row 的关联键改成小写看看
我试了, 错误提示为:
Undefined index: submit ... on line 28
Undefined index: submit ... on line 33
28行是 if(!$_REQUEST['submit']) 接受的是表单提交的数据
但你的表单中并没有名为 submit 的控件
楼上正解,给type为submit的input加name=submit
28行是 if(!$_REQUEST['submit']) 接受的是表单提交的数据
但你的表单中并没有名为 submit 的控件
那应该怎么改呢?
html文件: