Update a integer value.

admin

Administrator
Staff member
Hello,

I've made an Update page. Here you can update several values in a database.
Now my problem is that you can change every field, except my "OrderID" field. This field is my Primary and Unique field in my database and it is an integer.

I've written this, maybe you guys can help me to tell me what I should change to get my OrderID to change.


//Update Database 1
if ($index == 5 & $machineEdit != "")
{
$connection = mysql_pconnect ("localhost", "ramon", "mannetje1") or die ("No connection with MySQL Server.");
mysql_select_db ("heins") or die ("Can not reach the selected database on the MySQL Server.");
$string = "SELECT * from machines WHERE machineID='".$machineEdit."'";
$result = mysql_query ($string) or die("Can not run query on MySQL Server.");

$row = mysql_fetch_object($result);

print "<h3><u>You can change what's wrong here</u></h3><br>";
print "<form method='POST' action='MachineDatabase1.php?index=6'>
OrderID:<BR><input type='integer' name='machineID' size='20' value='http://www.phpbuilder.com/board/archive/index.php/".$row->machineID."'><BR>
</textarea><BR>
Machine Name:<BR> <input type='text' name='nameID' size='20' value='http://www.phpbuilder.com/board/archive/index.php/".$row->nameID."'><BR>
</textarea><BR>
Description:<BR> <input type='text' name='description' size='20' value='http://www.phpbuilder.com/board/archive/index.php/".$row->description."'><BR>
</textarea><BR>
Company Name:<BR> <input type='text' name='company' size='20' value='http://www.phpbuilder.com/board/archive/index.php/".$row->company."'><BR>
</textarea><BR>
Country:<BR> <input type='text' name='land' size='20' value='http://www.phpbuilder.com/board/archive/index.php/".$row->land."'><BR>
</textarea><BR><BR>
<input type='submit' value='http://www.phpbuilder.com/board/archive/index.php/Update' name='OK_button'></p><BR>
</form>";

print "<p><a href='http://www.phpbuilder.com/board/archive/index.php/MachineDatabase1.php?index=2'>Click to go back to whole database</a></p>";

}


//Update database 2
if ($index == 6 & $machineID != "")
{
$connection = mysql_pconnect ("localhost", "ramon", "mannetje1") or die ("No connection with MySQL Server.");
mysql_select_db ("heins") or die ("Can not reach the selected database on the MySQL Server.");
$string = "UPDATE machines SET machineID='".$machineID."', nameID='".$nameID."', description='".$description."', company='".$company."', land='".$land."' WHERE machineID='".$machineID."'";
$result = mysql_query($string) or die ("Can not run query on MySQL Server.") ;

print "<h2>Update completed!</h2><BR><BR>";
print "<p><a href='http://www.phpbuilder.com/board/archive/index.php/MachineDatabase1.php?index=2'>Click to go back</a></p>";
}
 
Back
Top