Re: update mysql from php web page
| From: | John Nichel | Date: | Tue, 06 Apr 2004 22:52:51 +0000 |
| Subject: | Re: update mysql from php web page | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-182561@lists.php.net to get a copy of this message | ||
Chip Wiegand wrote:
I have an existing web page that pulls some data and displays it in form input fields. I would like to add the ability to edit those fields and submit the changes to the server, but have been unsuccessful. What bit of code do I need to add to the existing code?
This is the existing code to display the info --
$query = "select * from warranty WHERE OwnerName='$result'"; $results = mysql_query($query);
$row = mysql_fetch_array($results);
I probably need to use if(isset($submit)): and an update statement, but my attempt just causes the web page to display completely blank. This is what I tried -
if(isset($submit)):
$query1 = "update warranty set VesselName='$vessel',OwnerName='$owner',OwnerStreet='$address',OwnerCity='$city',OwnerState='$state',OwnerZip='$zip',OwnerCountry='$country',DateInstalled='$DateInstalled',DealerName='$Dealer',DealerStreet='$DealerAddress',DealerCity='$DealerCity',DealerState='$DealerState',DealerZip='$DealerZip',DealerCountry='$DealerCountry',Model='$Parts',SN='$PartsSN',VesselType='$vesseltype',VesselLength='$length',InstalledOn='$construction',VesselTypeOther='$vesseltypeother') ;
$result1 = mysql_query($query1);
mysql_query($query1); else:
$query = "select * from warranty WHERE OwnerName='$result'"; $results = mysql_query($query);
$row = mysql_fetch_array($results);
?>
What am I doing wrong?
Thanks,
--
Chip
register_globals is probably off....
echo out the query to see if your variables are populated.
--
By-Tor.com
It's all about the Rush
http://www.by-tor.com