jesushax Posted June 11, 2008 Share Posted June 11, 2008 hi below is my test code basic as anything yet it doesnt work :S anyone know why? Cheers $ID = $_GET["ID"]; $a = mysql_query("SELECT * FROM tblUsers WHERE md5(UserID)='$ID'") or die(mysql_error()); while ($b = mysql_fetch_array($a)) { echo $b["UserID"]; } Quote Link to comment https://forums.phpfreaks.com/topic/109710-solved-simple-code-not-working-i-cant-see-no-errors/ Share on other sites More sharing options...
bluejay002 Posted June 11, 2008 Share Posted June 11, 2008 can you give more details in your code and the error it displays or whatever the problem that you encountered? Quote Link to comment https://forums.phpfreaks.com/topic/109710-solved-simple-code-not-working-i-cant-see-no-errors/#findComment-562955 Share on other sites More sharing options...
jesushax Posted June 11, 2008 Author Share Posted June 11, 2008 herse the full scope ive removed all my other code cos im just trying to make it return a result but it wont no errors either ive echoed my sql and that ouputs fine its just not outputting anything :S switch(@$_GET["mode"]) { case "update": //udate code here break; default: $ID = $_GET["ID"]; $a = mysql_query("SELECT * FROM tblUsers WHERE md5(UserID)='$ID'") or die(mysql_error()); while ($b = mysql_fetch_array($a)) { echo $b["UserID"]; } break; } Quote Link to comment https://forums.phpfreaks.com/topic/109710-solved-simple-code-not-working-i-cant-see-no-errors/#findComment-562956 Share on other sites More sharing options...
monkeytooth Posted June 11, 2008 Share Posted June 11, 2008 Whats the error your getting though upon tempting to run the script? Quote Link to comment https://forums.phpfreaks.com/topic/109710-solved-simple-code-not-working-i-cant-see-no-errors/#findComment-562959 Share on other sites More sharing options...
monkeytooth Posted June 11, 2008 Share Posted June 11, 2008 nevermind just read that bit that says it comes up with none.. my bad Quote Link to comment https://forums.phpfreaks.com/topic/109710-solved-simple-code-not-working-i-cant-see-no-errors/#findComment-562960 Share on other sites More sharing options...
jesushax Posted June 11, 2008 Author Share Posted June 11, 2008 right i know what it is now, but dont know why it is... This Works... $a = mysql_query("SELECT * FROM tblUsers WHERE UserID='5'") or die(mysql_error()); while ($b = mysql_fetch_array($a)) { echo $b["UserCompanyName"]; } But when getting an MD5'd ID from the url the ID in the url has already been md5 it doesnt work...? $ID = $_GET["ID"]; $a = mysql_query("SELECT * FROM tblUsers WHERE md5(UserID)='$ID'") or die(mysql_error()); while ($b = mysql_fetch_array($a)) { echo $b["UserCompanyName"]; } Quote Link to comment https://forums.phpfreaks.com/topic/109710-solved-simple-code-not-working-i-cant-see-no-errors/#findComment-562961 Share on other sites More sharing options...
monkeytooth Posted June 11, 2008 Share Posted June 11, 2008 md5(UserID) that cant be a table name on your database? is it? $a = mysql_query("SELECT * FROM tblUsers [b]WHERE md5(UserID)='$ID'") [/b] or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/109710-solved-simple-code-not-working-i-cant-see-no-errors/#findComment-562962 Share on other sites More sharing options...
jesushax Posted June 11, 2008 Author Share Posted June 11, 2008 figured it out the md5 the url is passing does not match the md5 where trying to retrieve, ill figure out where its coming from... Thanks for offering assistance though Quote Link to comment https://forums.phpfreaks.com/topic/109710-solved-simple-code-not-working-i-cant-see-no-errors/#findComment-562963 Share on other sites More sharing options...
monkeytooth Posted June 11, 2008 Share Posted June 11, 2008 Im seeing a few potential errors.. over all though not knowing the full scope of your over all coding I cant help much.. where are you getting the ID from? a Form? Are you trying to compare said ID to a UserID? Quote Link to comment https://forums.phpfreaks.com/topic/109710-solved-simple-code-not-working-i-cant-see-no-errors/#findComment-562965 Share on other sites More sharing options...
monkeytooth Posted June 11, 2008 Share Posted June 11, 2008 No problem. I am not 100% fully knowlegeful on MD5 but from what i have learned its got its up and its got its downs.. One its got its limits, and 2.. not always is every hash created equal. Quote Link to comment https://forums.phpfreaks.com/topic/109710-solved-simple-code-not-working-i-cant-see-no-errors/#findComment-562967 Share on other sites More sharing options...
jesushax Posted June 11, 2008 Author Share Posted June 11, 2008 fixed it Quote Link to comment https://forums.phpfreaks.com/topic/109710-solved-simple-code-not-working-i-cant-see-no-errors/#findComment-562972 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.