php - sql error when using HASH()? -


mysql query error: select hash('sha512', ( concat( lang_id, '-', word_app, '-', word_pack, '-', word_key ) ) word_lookup, word_id, hash('sha512', word_default) word_default, word_default_version forum_core_sys_lang_words word_app='core' , lang_id in(1)  sql error: have error in sql syntax; check manual corresponds mysql server version right syntax use near '('sha512', ( concat( lang_id, '-', word_app, '-', word_pack, '-', word_key ) ) a' @ line 1 sql error code: 1064 date: thursday 18th july 2013 03:34:35 pm 

i using ipboard forums, , decided not use md5, , use sha512 instead. using notepad++, renamed md5( hash('sha512',.

and after installation, sql error.

does mean sql query doesn't support hash()? how can fix it?

    $this->db->build( array( 'select'   => "hash('sha512', ( concat( lang_id, '-', word_app, '-', word_pack, '-', word_key ) ) word_lookup, word_id, hash('sha512', word_default) word_default, word_default_version",                              'from'     => 'core_sys_lang_words',                              'where'    => "word_app='{$app_override}' , lang_id in(" . implode( ",", $lang_ids ) . ")" ) );     $this->db->execute(); 

the hash functions in mysql sha1 , sha2. can refer mysql documentation proper syntax(https://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html#function_sha2)

in case code should be

$this->db->build( array(     'select'   => "sha2(concat( lang_id, '-', word_app, '-', word_pack, '-', word_key ), 512) word_lookup, word_id, sha2(word_default, 512) word_default, word_default_version",     'from'     => 'core_sys_lang_words',     'where'    => "word_app='{$app_override}' , lang_id in(" . implode( ",", $lang_ids ) . ")" )); 

sha2 available in mysql versions 5.5.5 , above. alternatively can use old sha1 function here cannot control bit length.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -