Jump to content

simple md5 question


fife

Recommended Posts

Hi.  I have an ID in md5 format but in the database its not.  I pass the md5 ID to a page and then I am trying to load the correct record via a look up in the database of that ID.  Im wondering is this code possible?

 

 

<?php $query = mysql_query("SELECT * FROM table WHERE ".md5(tableID)." = $ID"); ?>

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/252026-simple-md5-question/
Share on other sites

If $ID is an md5 value, it is a string and needs to be enclosed in single-quotes in the query statement. If tableID is a column in your table, you cannot use php's md5() function on the value, you must use mysql's md5 function on the value inside the query statement.

 

$query = mysql_query("SELECT * FROM table WHERE md5(tableID) = '$ID'");

Link to comment
https://forums.phpfreaks.com/topic/252026-simple-md5-question/#findComment-1292301
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.