A Database Error Occured

Error number 1064

You have an error in your SQL syntax; check the syntax for the use of the syntax to use the 'order =' a: 70 ... at line 1.

How to solve? See the error because of the quotes, but how to make him miss it. Such a request:

$this->db->query("UPDATE `order` SET name='$name', date='$date', adres='$adres', tel='$tel',metro='$metro',text='$text',order='$ar' WHERE id='$id'"); 
  • 2
    To solve such problems, most use thermorectal cryptanalysis. Use this method of stimulation near the central nervous system, you will see the result in a couple of minutes and it will surely please) - LordySL
  • Very funny! I attached a screen error from above - blud
  • SQL injection? - Vladimir Gordeev
  • Not. I am writing a site on codeigniter and this data has jumped out when entering data, I can’t decide it, please help. - blud

2 answers 2

 $this->db->query("UPDATE `order` SET `name`='".$name."', `date`='".$date."', `adres`='".$adres."', `tel`='".$tel."',`metro`='".$metro."',`text`='".$text."',`order`='".$ar."' WHERE `id`='".$id."'"); 

do not be lazy to put quotes!

ps you have an order field in the order table? These are bad taste rules!

  • It worked! thanks - blud
  • one
    set +1 and accept the answer - Artem
  • one
    @Shrek plus) sorry that my mention is desirable how to write did not help XD) - Palmervan
  • @Palmervan well I think it helped! and you, +1 - Artem



And it is desirable to write so name='".$name."' , Etc.

  • did not help - blud