Jump to content

[SOLVED] simple code not working, i cant see no errors...


Recommended Posts

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"];
}

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;
}

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"];
}

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?

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.