Jump to content

Passing through UserID


jarv

Recommended Posts

here is my code:

$query2 = "SELECT * FROM members_copy WHERE RSUSER = ".$_SESSION["rsUser"]."";
$result2 = mysql_query($query2);
$UserID = $result2['USERID'];
echo $UserID;

 

 

When I echo out UserID it doesn't show a number?!

 

Please help?!

Link to comment
Share on other sites

here is my login functions:

function checkPass($login, $password) {
/*
Password checking function:
This is a simple function that takes the $login name and
$password that a user submits in a form and checks that a
row exists in the database where:

the value of the 'login' column is the same as the value in $login
and
the value of the 'password' column is the same as the value in $password

If exactly one row is returned, then that row of data is returned.
If no row is found, the function returns 'false'.
*/
global $link;

$query="SELECT rsUser, rsPass FROM members WHERE rsUser='$login' and rsPass='$password'";
$result=mysql_query($query, $link)
	or die("checkPass fatal error: ".mysql_error());

// Check exactly one row is found:
if(mysql_num_rows($result)==1) {
	$row=mysql_fetch_array($result);
	return $row;
}
//Bad Login:
return false;
} // end func checkPass($login, $password)


/******************************************************\
* Function Name : cleanMemberSession($login, $pass)
*
* Task : populate a session variable
*
* Arguments : string $login, string $pass
			taken from users table in db.
*
* Returns : none
*
\******************************************************/
function cleanMemberSession($login, $password) {
/*
Member session initialization function:
This function initializes 3 session variables:
  $login, $password and $loggedIn.

$login and $password are used on member pages (where you
could allow the user to change their password for example).

$loggedIn is a simple boolean variable which indicates
whether or not the user is currently logged in.
*/

$_SESSION["rsUser"]=$login;
$_SESSION["rsPass"]=$password;
$_SESSION["loggedIn"]=true;
} // end func cleanMemberSession($login, $pass)

Link to comment
Share on other sites

i think the session variable stores alphanumeric data...

 

CHANGE:::

$data = "SELECT * FROM members_copy WHERE RSUSER = ".$_SESSION["rsUser"];

$info = mysql_fetch_array($data); 

 

DO THIS:::

//note that i have added quites befire and after your session variable...
$data = "SELECT * FROM members_copy WHERE RSUSER = ' ".$_SESSION["rsUser"]." ' ";
$info = mysql_fetch_array($data);
//say if user_id is the user id column in your table then
echo $info['usr_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.