The sql_hex() function returns a numeric value for a hexadecimal expression, transforming 09af into 0x09af (for MySQL and SQLite). This is principally used to write hexadecimal content into a numerically-typed SQL column.

It accepts 3 parameters:

  1. $val is the character string to be translated,
  2. $serveur,
  3. $option.


$hex = sql_hex('0123456789abcdef');
sql_updateq('table', array('column'=>$hex), 'id_table=' . $id_table);

Author Mark Baber Published : Updated : 12/03/23

Translations : English, français