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
https://forums.phpfreaks.com/topic/130329-solved-may-someone-like-to-help-me/
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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.