This question already has an answer here:
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"> 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>