Jump to content

Mysql Help


Snaxpac

Recommended Posts

Hey guys,

 

I'm trying to pull an int($id) out of my database, however, whenever I output the result it says 'array'... What am I doing wrong? Is it that I'm storing it into the variable wrong?

 

function getHome($session_id, $email, $encryptedPassword) {

if (! isset($session_id) || ! isset($email) || ! isset($encryptedPassword)){
	return "Login Error: You need to enter a vailid Email and Password! Retuen <a href = index.php>Home</a>";
} else {

	$connection = @ mysql_connect(HOST, USER, PASSWORD)
		or die("Could not connect");
	mysql_select_db(DATABASE, $connection)
		or showerror();

	$salt = substr($email, 0, 2);
	$enc_session_id = crypt($session_id, $salt);

	$query = "SELECT member_id FROM as2_members" .
			   " WHERE email = '$email'" .
			   " AND password = '$encryptedPassword'" .
			   " AND session_id = '$enc_session_id'"
	$result = mysql_query($query, $connection) or showerror();
	$id = mysql_fetch_array($result);
	mysql_close($connection) or showerror();

	return "Logging In... " . $id;
}
}

 

Any help would be great thanks =).

Link to comment
Share on other sites

Thanks for the reply =)

 

When pulling the int out of the database it is making it an array? How do i get it to actually to display the int value? When I do that its just showing what is at position 0 which is nothing?

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.