Archive for the tag 'code'

Sep 19 2008

Create random password in mysql

Published by Root under Mysql, Php, programlama

The scenario;
I coded my script but i want to change password with mysql. (Maybe want to change a lot row). My password length have 8 character.
[MYSQL]
UPDATE mycostumerdata SET password=SUBSTRING(MD5(ROUND(RAND(9999)*1000)),1,8)
[/MYSQL]
You can add any coloum for better random password.
Web sitesi programlaması yaparken bazen eski veritabanlarımızdan yararlanabiliriz. Bu kayıtlarımıza ait şifreleri yeniden oluşturmak bazen düşündüğümüzden daha zor olabilir. [...]

No responses yet

Sep 16 2008

How can update my record with another record?

Published by Root under Mysql, simple, starter

The scenario;
I have a lot of records on my test table. And costumer want to “Need a order by manualy”. So i want to update my table and set new order value. The new order value is old id value.
Here is code;
[MYSQL]
UPDATE Mytable SET ordervalue = oldid
[/MYSQL]
Bir Arkadaşım kendisine ait bir veritabanında yeni bir alan [...]

No responses yet

Jul 29 2008

How can find duplicate record in mysql?

Published by Root under Mysql

Yeah. It looks simple if there is some unique column, but if not!!!
I search answer on web and i found something.
[MYSQL]
SELECT CONCAT( `firstname` , `lastname` ) as keyac , count( CONCAT( `firstname` , `lastname` ) ) AS numOfRecord FROM users
GROUP BY CONCAT( `firstname` , `lastname` ) HAVING ( COUNT( CONCAT( `firstname` , `lastname` ) ) [...]

No responses yet