Hello, i want to get a record from a database, have the fields data in the database and than able to update it. This is the code i am using (below) and am tring to edit the values $name, $url, and $email. Also, the primary key is the field $name.
You help is appreciated. Thank you!
<?php
if ($doit==1)
{
$user = "username";
$pass = "password";
$db = "database";
$link = mysql_connect( "localhost", $user, $pass );
if ( ! $link )
die( "Couldn't connect to MySQL" );
mysql_select_db( $db )
or die ( "Couldn't open $db: ".mysql_error() );
$query = "UPDATE rhd_traffic set name = '$name', url = '$url', email = '$email' where primaryKey = '$primaryKey'"
mysql_query( $query, $link)
or die ( "Couldn't add data to \"rhd_traffic\" tables: "
.mysql_error() );
mysql_close( $link );
}
?>
<!--
<body>
<blockquote>
<form name="form" action="test.php" method="post">
<input type="hidden" name="doit" value="1">
Select Program Name:
<input type="text" name="$primaryKey" size="20">
<br>
Program Name:
<input type="text" name="name" value="<? echo $name ?> size="20">
<br>
Home URL:
<input type="text" name="url" value="<? echo $url ?> size="20">
<br>
Email Address:
<input type="text" name="email" value="<? echo $email ?> size="20">
<br>
<input type="submit"><input type="reset">
</blockquote>
</body>
-->