Jump to content

[SOLVED] May someone like to help me? =)


Twister1004

Recommended Posts

Hey everyone! As you know it is me! I'm just having a little more trouble. This time it includes the $_GET method. I know how it work but I just recently figured it out! *yay go me!* However, I've got part of it right,but now, I can't get the second part right.

 

Objective: To figure out why this query isnt working which is using the $_GET method to get its information for the query.

 

The problem starts here,

$account = mysql_query("SELECT first_name, last_name, age FROM `account` WHERE `first_name` = $getuser");
if (!$account) {
    echo 'There is an error in your profile. Please contact the adminstartor with the following error.2: ' . mysql_error();
    exit();
}

 

Here is where the value of the variable,

$getuser = $_GET['username']; 
$getid = $_GET['user'];

 

This is how the link is made,

<input name="button4" type="button" onClick='parent.window.location.href = "./profile.php?user=<?php echo $user; ?>&username=<?php echo $username; ?>"' value="Profile" />

 

This is how i set the link equal

		@$user = $_SESSION['login_id'];
	@$username = $_SESSION['login_first'];

 

Any help or suggestion or hints would be greatly appreciated =D

Link to comment
Share on other sites

the tick marks around account and first_name are actually fine to use, (in fact, I encourage them! :D) but yes, you need single quotes around $getuser

 

$account = mysql_query("SELECT first_name, last_name, age FROM `account` WHERE `first_name` = '$getuser'") or die(mysql_error());

 

you may also notice I added or die(mysql_error()); above, this will show you if there are any other syntax errors in your query in the future.

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.