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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.