注意:删除项目时未定义索引

时间:2017-12-24 06:51:49

标签: php

我想删除一个条目,但不断收到这些错误:

  

注意:未定义的索引:wineTypeID in   第33行/storage/ssd5/765/3453765/public_html/wine_action.php

     

注意:未定义的索引:wineName in   第34行/storage/ssd5/765/3453765/public_html/wine_action.php

     

注意:未定义的索引:wineSize in   第35行/storage/ssd5/765/3453765/public_html/wine_action.php

     

注意:未定义的索引:winePrice in   第36行/storage/ssd5/765/3453765/public_html/wine_action.php

我的代码看起来像这样

<?php

// include the connection stream include 'connectYes.php';

// here are the two hiddent fields

// they tell the script is this is an add, update or delete

// and for an update and delete, they pass the id

$action = $_REQUEST["action"];

$id = $_REQUEST["id"];

$wineTypeID = $_REQUEST["wineTypeID"];

$wineName = $_REQUEST["wineName"];

$wineSize = $_REQUEST["wineSize"];

$winePrice = $_REQUEST["winePrice"];

if ($action == 'a') {

$query = "insert into WINE values (

null,

'$wineTypeID',

'$wineName',

'$wineSize',

'$winePrice'

)";

mysqli_query($conn,$query)

or die (mysqli_error());

print "<h3>The Item    $wineName is added to the List</h3>";
" </h3>";

}

if ($action == 'u') {

$query = "update WINE

set wineTypeID = '$wineTypeID',

wineName = '$wineName',

wineSize = '$wineSize',

winePrice = '$winePrice'

where wineID = '$id'"; 

mysqli_query($conn, $query) 

or     die(mysqli_error());

print "<h3>Update Successful</h3>";
} // end u

if ($action == 'd') {

$query = "delete from WINE

where wineID = '$id'";

mysqli_query($conn, $query)

     or die("query failed:" . mysqli_error());

print "<h3>Delete Successful</h3>";
}

?>}

指向我的信息页的链接: - my page

链接到我的文件: - Php Files

mysql结构图片: - Mysql structure

1 个答案:

答案 0 :(得分:0)

请检查请求参数是否&#34; wineTypeID&#34; paremeter正在通过与否。