无法编辑我的php数据[重复]

I have counter an error that cannot view my data after I have update the data into my database.

As my database: Name: item_id; Type: char; Type: Primary key

Error Message:

Notice: Undefined index: item_id in ...\\Testing\itemEdit.php on line 14

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in ...\\Testing\itemEdit.php on line 17

Not found Data

This is my itemEdit.php code:

<?php
$host = "localhost";
$username = "root";
$password = "";
$database = "db_test";

// make the connect to mysql
$link = mysql_connect($host, $username, $password);
If ($link == false){
    die ('Could not connect'.mysql_error());
}

//$item_id=$row_item['item_id'];
$itemID = mysql_escape_string($_GET['item_id']);
$strSQL = "SELECT * FROM item_db WHERE item_id = '$itemID'";
$objQuery = mysql_query($strSQL);
while ($objResult = mysql_fetch_array($objQuery)){
if(!$objResult)
{
    echo "Not found Data";
}
else
{
    echo "Error Save [".$strSQL."]";
}
}
mysql_close($link);
?>

<html>
<head>
<title>Staff Edit Record</title>
</head>
<body>
<div style = "border: solid 1px black;
            background-color: beige;">

<p>
    <label for="itemID">&nbsp; Item ID:</label> 
    <input type="text" name="itemID" size="25" value="<?php echo $objResult["item_id"];?>">
</p>

</div>
</body>
</html>

Please help to specific and provide the code as I am beginner on php..

Thanks a lot...

</div>

Update your code to following code.

<?php
$host = "localhost";
$username = "root";
$password = "";
$database = "db_test";

// make the connect to mysql
$link = mysql_connect($host, $username, $password);
if($link == false)
{
    die ('Could not connect'.mysql_error());
}


$itemID = mysql_escape_string($_GET['item_id']);
$strSQL = "SELECT * FROM item_db WHERE item_id = '$itemID'";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);

if(isset($_POST))
{
    //$item_id=$row_item['item_id'];
    $newItemID = mysql_escape_string($_POST['item_id']);
    $strSQL = "UPDATE item_db SET item_id = '$newItemID' WHERE item_id = '$itemID'";
    $objQuery = mysql_query($strSQL);
    while($objResult = mysql_fetch_array($objQuery))
    {
        if(!$objResult)
        {
            echo "Not found Data";
        }
        else
        {
            echo "Error Save [".$strSQL."]";
        }
    }
}
mysql_close($link);
?>

<html>
<head>
<title>Staff Edit Record</title>
</head>
<body>
<div style = "border: solid 1px black; background-color: beige;">

<form method="post" action="">
<p>
    <label for="itemID">&nbsp; Item ID:</label> 
    <input type="text" name="item_id" size="25" value="<?php echo $objResult["item_id"];?>">
</p>

    <input type="submit" value="UPDATE">
</form>


</div>
</body>
</html>

Note mysql extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQL extension should be used.