How can I store the result of:
$store = md5("test", true);
mysql_query(...)
in a mysql db with a string query?
How can I store the result of:
$store = md5("test", true);
mysql_query(...)
in a mysql db with a string query?
Create a BINARY(16) field with index.
$store = md5("test", true);
mysql_query("INSERT INTO `Table` (`Field`) VALUES ('$store')");
If you want to store it in binary format, you should pass binary data as hex to MySQL:
$md5 = md5('test'); // Returns MD5 in HEX
mysql_query("INSERT INTO `table` (`field`) VALUES (0x" . $md5 . ")");
Don't worry about MySQL handling this as integer, it won't. So if the field is declared as BINARY/BLOB, the hexadecimal value will be interpreted as binary.