Newbie is trying to edit a mysql record on my local machine using mysql
3.23.34 and PHP 4.04
and nothing gets updated after changes are made.
I would be most grateful for any help
Thank you
Gee.

<html>
<head>
</head>
<body>
<table border=0 cellpadding=4 cellspacing=0 width=730 align=center>
<? echo "<form method='post' action='$PHP_SELF'>"; ?>
<?
include("matai.inc");

mysql_connect(localhost,$user,$password);

$query1 = "select * from $table where id = '$id'";

$result1 = mysql_db_query('matai',$query1);

while($row = mysql_fetch_object($result1)) {

print "<tr><td align=right>Latin Name:</td><td align=left> <input type=text
name='latin_name' value='$row->latin_name'></td></tr>";
print "<tr><td align=right>Common Name:</td><td align=left> <input type=text
name='common_name' value='$row->common_name'></td></tr>";
print "<tr><td align=right>Description:</td><td align=left> <input type=text
name='description' value='$row->description'></td></tr>";
print "<tr><td align=right>Height:</td><td align=left> <input type=text
name='height' value='$row->height'></td></tr>";
print "<tr><td align=right>Growth Rate:</td><td align=left> <input type=text
name='growth_rate' value='$row->growth_rate'></td></tr>";
print "<tr><td align=right>Soil Requirement:</td><td align=left> <input
type=text name='soil_requirement'
value='$row->soil_requirement'></td></tr>";
print "<tr><td align=right>Price 100:</td><td align=left> <input type=text
name='price100' value='$row->price100'></td></tr>";
print "<tr><td align=right>Price 200:</td><td align=left> <input type=text
name='price200' value='$row->price200'></td></tr>";
print "<tr><td align=right>Price 1000:</td><td align=left> <input type=text
name='price1000' value='$row->price1000'></td></tr>";

$id = $row->id;
}
echo "</table><p>";
echo "<br><input type=hidden name='id' value='$id'>";
?>
<table border=0 cellpadding=4 cellspacing=0 width=730 align=center>
<input type=submit name="change" value="Update record">

</form>

<?

if ($change) {
    //Do some error-checking first
    if($latin_name == "" || $common_name == "" ) {
        die("<b>You left one or more fields blank.</b>");
    }

    $sql = "UPDATE matai SET cat='$cat', latin_name='$latin_name',
common_name='$common_name',
            description='$description', height='$height',
growth_rate='$growth_rate', soil_requirement='$soil_requirement',
price='$price', frost_tolerance='$frost_tolerance', price100='$price100',
price1000='$price1000', onelitretubes='$onelitretubes',
price200='$price200', fivelitrepots='$fivelitrepots', price10='$price10',
Flowering_Season='$Flowering_Season', price500='$price500'

   where id='$id'";
    mysql_db_query('matai',$sql);
    echo "<b>Your record has been updated</b></p>";

 }
mysql_close();
?>
<a href='modconifers.php'><b>View updated database</b></a>
</table>
</body>
</html>




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to