PHP/MySQL Update code -


I am trying to call a line update call from mysql database from php. It fails, but when I try to call a new line, it is prepared in the same way. Value ('username', '$ username', '$ password', '$ studycode', '$ description) ',' $ Server '));

But this code fails

  $ result = mysql_query ("UPDATE auth SET username =' $ Username ', password =' ​​$ password ', studycode =' $ studycode ', description =' $ description ', server =' $ server 'where index =' $ id 'LIMIT 1; ");  

The first column for the index table and its key / ID is

EDIT: OK so I just went to mysql admin And my code tried the exact command sent to track the error.

  UPDATE auth SET username = 'username', password = 'password', study code = 'ab 9 102' , Description = 'test change', server = 'server 2' where index = '5' limit1;  

gives me an error

  # 1064 - There is an error in your SQL syntax; Use the 'index =' 5 'LIMIT 1' near the line 1 to use the correct syntax for manual related to your MySQL server version Mr. check  

Maybe a reserved keyword issue with the index. Try:

  $ result = mysql_query ("UPDATE auth SET username = '$ username', password = '$ password', studycode = '$ studycode', description = '$ description', Server = '$ server' where `index = '$ id' ');  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -