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 Link to comment https://forums.phpfreaks.com/topic/130329-solved-may-someone-like-to-help-me/ 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 Link to comment https://forums.phpfreaks.com/topic/130329-solved-may-someone-like-to-help-me/#findComment-675942 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. Link to comment https://forums.phpfreaks.com/topic/130329-solved-may-someone-like-to-help-me/#findComment-675946 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 Link to comment https://forums.phpfreaks.com/topic/130329-solved-may-someone-like-to-help-me/#findComment-675949 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). Link to comment https://forums.phpfreaks.com/topic/130329-solved-may-someone-like-to-help-me/#findComment-675957 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.