sql - Wrong values being updated in MySQL -


$salt2i working on login system , having problem updating salt tables. not expert in sql know way around.

my query update is:

update hashtable set `salt1` = 'salt1here' , `salt2` = 'salt2here' `userid` = userid 

userid integer value don't need quote that.

when update table salt1 set value of 0. using php create sql query , looks like:

update hashtable set `salt1` = '$salt1' , `$salt2` = 'salt2here' `userid` = $userid 

side note: know sql injection , have protection against in code. in case not need because salt values being generated script , user id value returned function. place have user input strip slashes , have ways prevent injection.

to me sql query seems correct , know values correct because dynamically created query looks like:

update hashtable set `salt1` = '9d6db1743e5e0cf1bb0e8cd799c0640231a10ec21e1612a6ed46e8ea16862835' , `salt2` = '0824b2aac446ccfbd719645f84b13443cbcf59ee4e6dabace8c421ff6a8c6688' `userid` = 1374770432 

i have entered in directly phpmyadmin , says 0 rows affected still changes salt1 row 0.

i baffled because seems i'm doing correctly not.

your sql query wrong;

update hashtable  set `salt1` = '$salt1' , `$salt2` = 'salt2here'  `userid` = $userid 

...should be...

update hashtable  set `salt1` = '$salt1', `$salt2` = 'salt2here'  `userid` = $userid 

currently, you're doing and operation between $salt1 , $salt2 = 'salt2here' (which seem return 0 in case) , store in salt1.


Comments

Popular posts from this blog

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -