Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9025041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T06:10:26+00:00 2026-06-16T06:10:26+00:00

i have this query which i use in order to update a table, the

  • 0

i have this query which i use in order to update a table, the issue is i ge this 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 'emri='Albana', klienti='Distribrands', telefoni='0662080090', montim='Kompjut' at line 1

I can’t find the error here.. it’s strange…
Please help me with this.
It’s an update query!
The query :

$sqlStart="UPDATE forma SET ";
$sql="";
if ($postDyqani_pergjegjes!= 'undefined') $sql .= " dyqani_pergjegjes='$postDyqani_pergjegjes',";
if ($postEmri!= 'undefined') $sql .= "  emri='$postEmri',";
if ($postKlienti!= 'undefined') $sql .= "  klienti='$postKlienti',";
if ($postTelefoni!= 'undefined') $sql .= "  telefoni='$postTelefoni',";
if ($postMontim!= 'undefined') $sql .= "  montim='$postMontim',";
if ($postAdresa!= 'undefined') $sql .= "  adresa='$postAdresa',";
if ($postData_e_shitjes!= 'undefined') $sql .= "  data_e_shitjes='$postData_e_shitjes',";
if ($postDifekti!= 'undefined') $sql .= "  difekti='$postDifekti',";
if ($postTekniku_emer!= 'undefined') $sql .= "  tekniku_emer='$postTekniku_emer',";
if ($postTekniku_mesazh!= 'undefined') $sql .= "  tekniku_mesazh='$postTekniku_mesazh',";
if ($postData_fillim!= 'undefined') $sql .= "  data_fillim='$postData_fillim',";
if ($postData_mbarim!= 'undefined') $sql .= "  data_mbarim='$postData_mbarim',";
if ($postData!= 'undefined') $sql .= "  data='$postData',";
if ($postStatus!= 'undefined') $sql .= "  status='$postStatus',";
// replace the last `,` for `;`
if ($sql != "") {
    // replace the last `,` for `;`
    $sql = substr($sql, 0, -1) . ";";
    // run sql command
    $sqlCommand = $sqlStart.$sql;
    $result=mysql_query($sql) or die(mysql_error()) ;

} else {
    // no fields to update
}

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T06:10:28+00:00Added an answer on June 16, 2026 at 6:10 am

    Your problem is you are executing $sql which is only half of the query. The full query is in $sqlCommand so execute that:

     $result=mysql_query($sqlCommand) or die(mysql_error()) ;
    

    Side notes: you should ensure that the variables are escaped for single quotes (see mysql_real_escape_string()). The mysql_* library is deprecated, so it is recommended to migrate to PDO or MySQLi.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this query which on executing in my sql command line client executes
I have this query which groups the results by ORDER#. SELECT ORDER#, MAX(SHIPDATE -
Right now I have this SQL query which is valid but always times out:
i have this code which i use in order to extract first all users
I have this query which is a dependant query and taking much execution time
I have this query which works correctly in MySQL. More background on it here
I have this query which returns a result set with Date(column) as nvarchar datatype.
I have this query, which is giving me some problems... I am trying to
I have this query. It matches anything which has South in its name. But
in my self-defined module I have this method which will query the db and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.