lampquest Posted February 5, 2007 Share Posted February 5, 2007 Hello friends, I am having problem writing an update statement to modify data in a mysql table named clientlog. Just cant figure out what is wrong with my statement. Pls help me out. My current code is as follows: $sql = "update clientlog set unique_id = '$serial', customer_code = '$code', customer_name = '$name', customer_address = '$address', phone = '$phone', customer_email = '$email', service_type = '$service', description = '$description', quote_ammount = '$quote', remarks = '$remark' where unique_id = '$serial'"; $result = mysql_query($sql); if (!$result) { echo "<center><font color='red'>Query Error</font><br><br> Error Updating Entries !</center>"; } else { echo "<center><br><br> <font color='red'> <b>Update Okay!</b></font> <br><br> Client with serial no $unique_id has been successfully changed.</font> <br><br></center>"; } I always get error updating entries. Femi Link to comment Share on other sites More sharing options...
fenway Posted February 5, 2007 Share Posted February 5, 2007 Post the output from mysql_error() in that control path. Link to comment Share on other sites More sharing options...
lampquest Posted February 5, 2007 Author Share Posted February 5, 2007 I made a modification which was pointed to me by another forum helper. The result was that I get notified that update is okay. But surprisingly no change is made on the data in the table. Pls help. This is the whole code in the script. Thanx <?php $code = $HTTP_POST_VARS['customer_code']; $name = $HTTP_POST_VARS['customer_name']; $address = $HTTP_POST_VARS['customer_address']; $phone = $HTTP_POST_VARS['customer_phone']; $email = $HTTP_POST_VARS['customer_email']; $service = $HTTP_POST_VARS['service_type']; $description = $HTTP_POST_VARS['service_description']; $quote = $HTTP_POST_VARS['quote_ammount']; $remark = $HTTP_POST_VARS['staff_remark']; if ($code == "") {echo "<li> Pls, specify Customer Code"; $error = 1;} if ($name == "") {echo "<li> Pls, specify Customer Name"; $error = 1;} if ($address == "") {echo "<li> Pls, specify Customer Name"; $error = 1;} if ($phone == "") {echo "<li> Pls, specify Customer Phone"; $error = 1;} if ($email == "") {echo "<li> Pls, specify Customer Email Address"; $error = 1;} if ($service == "") {echo "<li> Pls, select a Service Type"; $error = 1;} if ($quote == "") {echo "<li> Pls, specify Quote Ammount"; $error = 1;} if (!eregi("@",$email) or !eregi("\.",$email)) {echo "<li> Pls, specify valid Email Address"; $error = 1;} if ($error==1) { echo "<br><br><a href='javascript:history.back(-1)'>Click here</a> to make necessary adjustments as stated above !"; } else { include "connect.php"; $date = date("y-m-d"); $unique_id = $service.$code.$date; $sql = "update client_log set customer_code = '$code', customer_name = '$name', customer_address = '$address', phone = '$phone', customer_email = '$email', service_type = '$service', description = '$description', quote_ammount = '$quote', remarks = '$remark' where unique_id = '$serial'"; $result = mysql_query($sql); if (!$result) { echo "<center><font color='red'>Query Error</font><br><br> Error Updating Entries !</center>"; } else { echo "<center><br><br> <font color='red'> <b>Update Okay!</b></font> <br><br> Client with serial no $unique_id has been successfully changed.</font> <br><br></center>"; } } ?> Link to comment Share on other sites More sharing options...
fenway Posted February 5, 2007 Share Posted February 5, 2007 Huh? Link to comment Share on other sites More sharing options...
shoz Posted February 5, 2007 Share Posted February 5, 2007 You haven't tried the mysql_error() suggestion and you've made duplicate topics on the board about this issue. Read through the Board Guidelines before your next post. Link to comment Share on other sites More sharing options...
Recommended Posts