Twister1004 Posted October 27, 2008 Share Posted October 27, 2008 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 Quote Link to comment Share on other sites More sharing options...
limitphp Posted October 27, 2008 Share Posted October 27, 2008 take single quotes off of account and first_name and put quotes around $getuser Quote Link to comment Share on other sites More sharing options...
genericnumber1 Posted October 27, 2008 Share Posted October 27, 2008 the tick marks around account and first_name are actually fine to use, (in fact, I encourage them! ) 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. Quote Link to comment Share on other sites More sharing options...
Twister1004 Posted October 27, 2008 Author Share Posted October 27, 2008 Ok. I see now. However, I didn't think i didn't need to use them since i used a variable without single quotes. But thank you =) At least you tried limitphp =D Quote Link to comment Share on other sites More sharing options...
genericnumber1 Posted October 27, 2008 Share Posted October 27, 2008 No, limitphp was right, it would also work perfectly fine without the backticks around the variables. You can dodge using single quotes if the column is something other than a string (eg. an integer). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.