nba1985 Posted September 27, 2008 Share Posted September 27, 2008 Hi all, My friend is having a problem so I said I'd post for him on here as he is away at the minute. Here is his problem, hope someone can help, thanks in advance. "i have a site, where you login in, and then i want to show stats (name, favourite football club, games played, goals scored etc) i have this file called view_profile.php that then links to view_profile.tpl.php. the error im getting is 'There was no username entered in the URL.' I think all that need to happen is for it to get the right username that your logged in under, but this is not showing it, can someone tell me what is missing? Also, if you fancy helping to complete this website, and play fifa 08/09, please give me a shout!" <?php require "global.php"; $body = new template(TPL_ROOT); check_login(); if(!$_GET['get_username']) { full_error("Error", "There was no username entered in the URL."); exit; } $get_username = secure_input($_GET['get_username']); $get_username = str_replace("_", " ", $get_username); $user_query = $mysql->query("SELECT username, user_level, real_name, favourite_clubs, age, short_bio, nationality, second_nationality, positions, register_timestamp, lastlogin_timestamp FROM users WHERE username='".$get_username."'"); if($mysql->num_rows($user_query) < 1) { full_error("Error", "There is no user with the name of, <strong>".$get_username."</strong>."); exit; } $user_results = $mysql->fetch_array($user_query); $title = $user_results['username']; $body->set('user_results', $user_results); $tpl->set('title', $title); $body->set('error', null); $tpl->set('body', $body->fetch("view_profile.tpl.php")); echo $tpl->fetch('template.tpl.php'); $mysql->close(); ?> [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted September 27, 2008 Share Posted September 27, 2008 How does the user access view_profile.php? Your code will only work if your url is: http://yoursite.com/view_profile.php?get_username=USERNAME_HERE $_GET returns variables from the url. Quote Link to comment Share on other sites More sharing options...
nba1985 Posted September 27, 2008 Author Share Posted September 27, 2008 Thanks Can you advise How to do a plain page which just shows the details from a mysql db? Quote Link to comment Share on other sites More sharing options...
corbin Posted September 28, 2008 Share Posted September 28, 2008 Learning PHP basics would help to start with. Then, learn how to pull information from a database based on PHP variables. ;p 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.