0

i am new to php programming. I always get this error when i run my code

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE service_name = ''' at line 7

this is my code

<?php
session_start();
include('../conn/openconn.php');
if(isset($_POST['butsend'])) {

$servicename = strtoupper($_POST['txtservicename']);
$serviceurl = $_POST['txtserviceurl'];
$id_div = $_POST['select_div'];
$id_unit = $_POST['select_unit'];
$servicedesc = $_POST['txtservicedesc'];
$id = $_SESSION['service_name'];

$updateuser = "UPDATE service SET 
               service_name = '$servicename',
               service_url = '$serviceurl',              
               id_div = '$id_div',
               id_unit = '$id_unit',
               service_desc = '$servicedesc',
               WHERE service_name = '$id'";
    mysql_query($updateuser) or die (mysql_error());

}

?>

i have already search all the previous question but due to my limited knowledge in the programming i cannot find the solution. sorry for my bad english..

1 Answer 1

2

You have an extra comma. Remove it.

$updateuser = "UPDATE service SET 
           service_name = '$servicename',
           service_url = '$serviceurl',              
           id_div = '$id_div',
           id_unit = '$id_unit',
           service_desc = '$servicedesc', <-- HERE
           WHERE service_name = '$id'";
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.