hello all!
I'm trying to validate a pair of data columns on mysql from my php page across md5 function.
I've encrypted the string "helloworld" with php md5 function and attempted to compare it with MYSQL MD5 function but it won't work.
I do this because in the database there is a pair of strings "hello" and "world" needs to be compared with my php string, so:
<?php
$str_a = "hello";
$str_b = "world";
$str_encrypted = md5 ($str_a.$str_b);
// note "first_col" is "hello" and "second_col" is "world"
$sql = "UPDATE `my_table` SET `checked_col` = '1' WHERE MD5(CONCAT(first_col,second_col)) = '$str_encrypted' LIMIT 1;";
$res = mysql_query ($sql) or die (mysql_error());
($res) ? print "true" : print "false";
?>
This code return me false, and the database don't UPDATE the column checked column, but not mysql_error problems are returned.
Could the md5 from php generate a different MD5 from MYSQL?
a similar code written by a friend worked in the same server, but i don't have to much experience to see where is the difference
can someone explain me where I'm wrong?
thanks!