TwoArmadillos Posted February 4, 2009 Share Posted February 4, 2009 Hi, I've Googled this error code, but all the problems I can find seem to be caused by missing semi-colons. I don't think that's what's causing mine though. <?php include 'p7av685m/mysqlcon.php'; $guid = $_GET['GUID']; $sql = mysql_query("SELECT * FROM `users` WHERE `guid`='{$guid}'") or die (mysql_error()); //$result = mysql_fetch_array($sql); //echo $result['guid']; //echo mysql_num_rows($sql); if(mysql_num_rows($sql) == '1'){ $query = mysql_query("UPDATE `users` SET `is_active`='1' WHERE `guid`='".$guid."'") or die (mysql_error()); echo "Registration process complete. You are now activated."; } else { echo "User not found"; } include 'p7av685m/closecon.php'; ?> I can successfully run the actual query on phpmyadmin. But on the server it gives me this: Parse error: syntax error, unexpected T_VARIABLE on line 12. The currently commented out echos print successfully as well. Link to comment https://forums.phpfreaks.com/topic/143801-unexpected-t_variable/ Share on other sites More sharing options...
Snart Posted February 4, 2009 Share Posted February 4, 2009 What is the contents of those two included files? Link to comment https://forums.phpfreaks.com/topic/143801-unexpected-t_variable/#findComment-754502 Share on other sites More sharing options...
TwoArmadillos Posted February 4, 2009 Author Share Posted February 4, 2009 They connect to the database. The problem is not with them. Link to comment https://forums.phpfreaks.com/topic/143801-unexpected-t_variable/#findComment-754510 Share on other sites More sharing options...
gaza165 Posted February 4, 2009 Share Posted February 4, 2009 if(mysql_num_rows($sql) == '1'){ $query = mysql_query("UPDATE `users` SET `is_active`='1' WHERE `guid`='".$guid."'") or die (mysql_error()); echo "Registration process complete. You are now activated."; } else { echo "User not found"; } change this to <?php if(mysql_num_rows($sql) == '1'){ $query = mysql_query("UPDATE `users` SET `is_active`='1' WHERE `guid`='$guid' ") or die (mysql_error()); echo "Registration process complete. You are now activated."; } else { echo "User not found"; } ?> Link to comment https://forums.phpfreaks.com/topic/143801-unexpected-t_variable/#findComment-754522 Share on other sites More sharing options...
Snart Posted February 4, 2009 Share Posted February 4, 2009 Perhaps the contents of $guid is causing issues. Link to comment https://forums.phpfreaks.com/topic/143801-unexpected-t_variable/#findComment-754526 Share on other sites More sharing options...
TwoArmadillos Posted February 4, 2009 Author Share Posted February 4, 2009 Well, that did the job, thanks! Although it's still confusing because I had previously tried ='{$guid}' as well as ='$guid' like you have it there to no avail. Link to comment https://forums.phpfreaks.com/topic/143801-unexpected-t_variable/#findComment-754527 Share on other sites More sharing options...
gaza165 Posted February 4, 2009 Share Posted February 4, 2009 yeah what you did wrong was not closing the " for the mysql query... $query = mysql_query("UPDATE `users` SET `is_active`='1' WHERE `guid`='".$guid."'" ) or die (mysql_error()); there is no closing tag for the sql query. Link to comment https://forums.phpfreaks.com/topic/143801-unexpected-t_variable/#findComment-754535 Share on other sites More sharing options...
TwoArmadillos Posted February 4, 2009 Author Share Posted February 4, 2009 yeah what you did wrong was not closing the " for the mysql query... $query = mysql_query("UPDATE `users` SET `is_active`='1' WHERE `guid`='".$guid."'" ) or die (mysql_error()); there is no closing tag for the sql query. There seems to be? $query = mysql_query("UPDATE `users` SET `is_active`='1' WHERE `guid`='".$guid."'" ) or die (mysql_error()); Link to comment https://forums.phpfreaks.com/topic/143801-unexpected-t_variable/#findComment-754543 Share on other sites More sharing options...
gaza165 Posted February 4, 2009 Share Posted February 4, 2009 There seems to be? $query = mysql_query("UPDATE `users` SET `is_active`='1' WHERE `guid`='".$guid."'" ) or die (mysql_error()); no because that is closing the ' before it $query = mysql_query("UPDATE `users` SET `is_active`='1' WHERE `guid`='".$guid."'" ) or die (mysql_error()); becasue the red " is closing for the blue " you see? Link to comment https://forums.phpfreaks.com/topic/143801-unexpected-t_variable/#findComment-754548 Share on other sites More sharing options...
TwoArmadillos Posted February 4, 2009 Author Share Posted February 4, 2009 Not really! Because I thought the blue one there is closing for the previous one immediately before the .$guid Thanks for trying to explain it to me Link to comment https://forums.phpfreaks.com/topic/143801-unexpected-t_variable/#findComment-754556 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.