$accname =$_POST['uaccountname'];
$aid =$_POST['aid'];
if($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['submit'] =='update account')

{

    $qry = "UPDATE accounts SET acc_name = $accname WHERE acc_id =$aid";
    mysql_query($qry) or die(mysql_error());    
}   

it gives folling error

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 '' at line 1

i have written the following query
$qry ="UPDATE accounts SET acc_name = '".$accname."' WHERE acc_id =$aid";

but the issue doesnt resolve

Member Avatar for iamthwee

You shouldn't need to write it like that.

You should just be able to use single quotes with the query.

Member Avatar for diafol
$qry ="UPDATE accounts SET acc_name = '$accname' WHERE acc_id =$aid";

would be ok

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.