Kevin Castro Posted June 17, 2015 Share Posted June 17, 2015 I want to update more than one column in php using mysql. fr example: $sql="update table_name set where username='$user'; $sql="update table_name set where password='$pass'; how to concatenate this querie? could you tell anyone how to solve this? Thanks in advance Link to comment Share on other sites More sharing options...
dauruk0512 Posted June 17, 2015 Share Posted June 17, 2015 (edited) just more than one column but still one table right ! here is my query just give comma UPDATE `tabel_annual` SET `tglmulai` = '$tanggalmulai',`tglakhir` = '$tanggalakhir',`acara` = '$acara',`id_lokasi` = '$lokasi',`tarip` = '$tarif',`ket` = '$keterangan',`cp` = '$cp',`status` = '$cek' WHERE `tabel_annual`.`id_anual` ='$id' Hope this make sense sorry edited what do you mean multi query ! i saw your query trying update same table, please more detail what you want to Freddy Edited June 17, 2015 by dauruk0512 Link to comment Share on other sites More sharing options...
Kevin Castro Posted June 17, 2015 Author Share Posted June 17, 2015 fr eg:) i created 4 input tags namely username,update username,password and update password. i want to update old username into new username and old password into new password. here is the code for updating single column in php $sql="update students set where username='$user'; if i update password field how to combine with this same variable.... Link to comment Share on other sites More sharing options...
dauruk0512 Posted June 17, 2015 Share Posted June 17, 2015 sorry for late respond, you are write wrong query kevin ! if you want to update row in table, you need to post primary key too which show in your edit.php cause it need in your query clasue where, so your query wrong, i guess this is not change at all you data in table cause you need set each table ! update students set where username='$user here is my query suggest to you why there is id_user in my query because id_user is primary key, $usernmae, $password, $id is variabel came from your form, in this case you need show id_user in your form so you can update it, UPDATE `students ` SET `username` = '$username',`password` = '$password' WHERE `id_user` ='$id' so here is simple table from me ->id_user, usernmae, password oh ya almost forgot if you need encrypt your password you need md5 when you post password Hope this make sense, please let me know if working, Thanks Freddy Link to comment Share on other sites More sharing options...
Kevin Castro Posted June 17, 2015 Author Share Posted June 17, 2015 Thank you freddy,it was working Link to comment Share on other sites More sharing options...
Ingolme Posted June 18, 2015 Share Posted June 18, 2015 MD5 is not a secure way to encrypt passwords. From the PHP manual itself: http://php.net/md5 Note: Secure password hashing It is not recommended to use this function to secure passwords, due to the fast nature of this hashing algorithm. See here for details. Link to comment Share on other sites More sharing options...
dauruk0512 Posted June 18, 2015 Share Posted June 18, 2015 So to came this thread again ! so what the best way to make secure password ! i always use md5, do i old about this so what the best way to make secure password Foxy, Thanks ! Link to comment Share on other sites More sharing options...
Ingolme Posted June 18, 2015 Share Posted June 18, 2015 The answer is right in the PHP manual: http://php.net/manual/en/faq.passwords.php#faq.passwords.fasthash Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now