Not sure why. But try this:
<?php
// Connect to database
$connect= mysql_connect("localhost","root")
or die("Could not connect to database in localhost !");
mysql_select_db("testdiw")
or die("Could not select that database !");
if(!empty($_GET['action']) && $_GET['action'] === 'update')
{
$id = $_REQUEST['id'];
$_GET['id'] = $id;
$query = "UPDATE `mktime` SET diwtitle = '".$_REQUEST['newtitle']."'";
$result = mysql_query($query) or die("<b>mySQL Error:</b>".mysql_errono()."<br>".mysql_error());
if(!$result)
{
echo 'Error processing request.';
}
else
{
echo 'Request processed successfully.';
}
}
$id = $_GET['id'];
// The ID is passed through the URL to specify the row,
// Or it is set in the previous script.
$query = "SELECT * FROM mktime WHERE id = '$id'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
echo '<form name="update" method="post">
<input type="hidden" value="update" name="action">
<input type="hidden" name="id" value="'.$id.'">
<input type="text" name="newtitle" value="'.$row['diwtitle'].'"><br>
<input type="submit" value="Update">
</form>';
?>
I added a check for an SQL error, and modified small items of code.
REMEMBER: You don't need $result = mysql_select_db(). You just need to select it, not set it to a variable.
~Brett