Simple Update
Posted: Tue Apr 23, 2002 10:15 am
Hi Guys
I'm only new at php and im having problems with a simple update (so im told). I can retrieve but i now want to be able to update the data that appears and display errors if no data there to show etc... Any help is much appreciated! Heres the code below.
Jen.
<?php
if ($customer_search)
{
$db = mysql_connect("localhost", "fineart");
mysql_select_db("fineart", $db);
$result = mysql_query("select * from customer where customerid = $customer_search" );
$row = mysql_fetch_array($result);
$customer_search = $row['customerID'];
}
if($btnupdate)
$db = mysql_connect("localhost", "fineart");
mysql_select_db("fineart",$db);
$sql = "UPDATE customer SET title = '$title', fname = '$fname', lname = '$lname',
address1 = '$address1', phonenumber = '$phonenumber' WHERE customer_search = $customerid";
$result = mysql_query($sql);
echo $result;
<script language = "Javascript">
alert("Thank you! Information Updated");
</script>
?>
I'm only new at php and im having problems with a simple update (so im told). I can retrieve but i now want to be able to update the data that appears and display errors if no data there to show etc... Any help is much appreciated! Heres the code below.
Jen.
<?php
if ($customer_search)
{
$db = mysql_connect("localhost", "fineart");
mysql_select_db("fineart", $db);
$result = mysql_query("select * from customer where customerid = $customer_search" );
$row = mysql_fetch_array($result);
$customer_search = $row['customerID'];
}
if($btnupdate)
$db = mysql_connect("localhost", "fineart");
mysql_select_db("fineart",$db);
$sql = "UPDATE customer SET title = '$title', fname = '$fname', lname = '$lname',
address1 = '$address1', phonenumber = '$phonenumber' WHERE customer_search = $customerid";
$result = mysql_query($sql);
echo $result;
<script language = "Javascript">
alert("Thank you! Information Updated");
</script>
?>