rallokkcaz Posted September 2, 2006 Share Posted September 2, 2006 i need help making them! Quote Link to comment Share on other sites More sharing options...
.josh Posted September 2, 2006 Share Posted September 2, 2006 in the future, please try to search the forums for your question, before making a new post. here is a thread that addresses this very question, still on the very first page of the forum. http://www.phpfreaks.com/forums/index.php/topic,106521.0.html Quote Link to comment Share on other sites More sharing options...
rallokkcaz Posted September 2, 2006 Author Share Posted September 2, 2006 help? Quote Link to comment Share on other sites More sharing options...
.josh Posted September 2, 2006 Share Posted September 2, 2006 my first guess is that your username field in your table is varchar(10) and that's why you only have 10 chars for your usernames. as far as taking you to the login page and not the user info... you have the links pointing to users.php. is that code up there in users.php or is that in another file? because the code that displays the info is in that same code up there ^ so if you are pointing the links to somewhere else...and actually, you don't seem to have anything even in that code above, to display the info, after it's retrieved. so where's the part of your code where you're trying to display it?as far as getting the login page after you click on the link: my first guess is that you have your script checking to see if the person is logged in or not, but you aren't carrying that info over to the next page. Or rather, maybe you are trying to directly access this script for testing purposes, and you don't have any session_start() or you aren't "logged in", your "if not logged in" script is kicking you back to the login page. but these are only guesses, as i don't have access to the rest of your code. Quote Link to comment Share on other sites More sharing options...
rallokkcaz Posted September 2, 2006 Author Share Posted September 2, 2006 ok i fixed the user character thing!!!and i was linking to the wrong page oopsbut how can i make it si when you click the links it goes to the users info? here's the page/code![url=http://www.pokebash.com/user.php]http://www.pokebash.com/user.php[/url][code]<? include ("header.php"); ?><?php //connect to and select db $conn = mysql_connect('localhost','','') or die(mysql_error()); $db = mysql_select_db('pokebash_users',$conn) or die(mysql_error()); //get a list of the info from the table to make the linkies $sql = "select * from maaking_users"; $result = mysql_query($sql, $conn) or die(mysql_error()); // for each row fetched from the results... while ($list = mysql_fetch_array($result)) { //make the custom linkie echo "<a href= 'http://www.pokebash.com/user.php?id={$list['username']}'>{$list['username']}</a><br>"; } // end while // if the user clicked on a linkie and therefore an id exists (the is_numeric is a basic security precaution) ... if (is_numeric($_GET['username'])) { // for easier var syntax handling $id = $_GET['username']; // select the video from the db based on its id $sql = "select username from maaking_users where video_id = '$id'"; $result = mysql_query($sql, $conn) or die(mysql_error()); // if a video was found... $videofound = mysql_num_rows($result); if ($videofound) { $user = mysql_fetch_array($result); include ("header.php");echo "<center> $id"; } // end if found } // end if there was a linkie clicked[/code] Quote Link to comment Share on other sites More sharing options...
rallokkcaz Posted September 2, 2006 Author Share Posted September 2, 2006 people? Quote Link to comment Share on other sites More sharing options...
corbin Posted September 2, 2006 Share Posted September 2, 2006 Umm so what exactly are you trying to accomplish? Like where you can go to page.php?user=<user> and it displays theyre user info? It would help if you clarified what youre trying to do...(PS In response to your sig... I started PHP when I was about 12.5 :D) Quote Link to comment Share on other sites More sharing options...
rallokkcaz Posted September 2, 2006 Author Share Posted September 2, 2006 yes what you said and nice dude its good to start off earlyi think :D Quote Link to comment Share on other sites More sharing options...
rallokkcaz Posted September 2, 2006 Author Share Posted September 2, 2006 [quote author=corbin link=topic=106583.msg426390#msg426390 date=1157173164]Umm so what exactly are you trying to accomplish? Like where you can go to page.php?user=<user> and it displays theyre user info? It would help if you clarified what youre trying to do...[/quote]yes that is what i want to do!can you pleeze help? Quote Link to comment Share on other sites More sharing options...
corbin Posted September 2, 2006 Share Posted September 2, 2006 Umm what info are you tryin to display and how is it stored in your database? Quote Link to comment Share on other sites More sharing options...
rallokkcaz Posted September 2, 2006 Author Share Posted September 2, 2006 like the username full name ect... Quote Link to comment Share on other sites More sharing options...
rallokkcaz Posted September 2, 2006 Author Share Posted September 2, 2006 and i want to allow them to edit there info too Quote Link to comment Share on other sites More sharing options...
corbin Posted September 2, 2006 Share Posted September 2, 2006 Do you have a login script written? Youll need a login script to let them edit their info... And like what are the field names in the database and stuff? Quote Link to comment Share on other sites More sharing options...
rallokkcaz Posted September 2, 2006 Author Share Posted September 2, 2006 i have a login script written and register toothey are idusernamepasswordemailfullname Quote Link to comment Share on other sites More sharing options...
rallokkcaz Posted September 2, 2006 Author Share Posted September 2, 2006 dude? Quote Link to comment Share on other sites More sharing options...
corbin Posted September 2, 2006 Share Posted September 2, 2006 Sorry, got a bit distracted... Anyways I'm about to fall asleep so Im gonna head to bed... But if someone hasnt helped you tommorow I'll try :D. Quote Link to comment Share on other sites More sharing options...
rallokkcaz Posted September 2, 2006 Author Share Posted September 2, 2006 thanks g' night! Quote Link to comment Share on other sites More sharing options...
rallokkcaz Posted September 2, 2006 Author Share Posted September 2, 2006 lets get started again on this! ;D Quote Link to comment Share on other sites More sharing options...
w32 Posted September 2, 2006 Share Posted September 2, 2006 If you're trying to see user's info you'll normall have a page like this user.php?uid=1And then...you can get the info with something like this<?php//###########################################################if($_GET['uid']) { $sql['userdata'] = mysql_query("SELECT * FROM users WHERE userid='".$_GET['uid']."' "); //########IF USERID EXISTS##### if(mysql_num_rows($sql['userdata'])>0) { $sql['userdata'] = mysql_fetch_array($sql['userdata']); //######GET & DISPLAY SOME USER DATA##### $username = $sql['userdata']['username']; $email = $sql['userdata']['email']; echo $username .'<br />'. $email; } //#####USER DOESN'T EXIST###### else { echo 'This user is not in our database'; } }//#########REDIRECT IF UID IS NOT IN THE URL######### else { echo '<meta http-equiv="refresh" content="0;URL=any_url_you_choose" />'; }?>That's what I'd do to fetch user data hope it helps you Quote Link to comment Share on other sites More sharing options...
rallokkcaz Posted September 2, 2006 Author Share Posted September 2, 2006 it didn't work :(when you go to the page it just shows a blank page. Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 2, 2006 Share Posted September 2, 2006 post the code you got and having problams with. Quote Link to comment Share on other sites More sharing options...
w32 Posted September 2, 2006 Share Posted September 2, 2006 I did not write the script for you lol...it was an example for you to work upon ...I did comment it, thought you'd modify it :D Quote Link to comment Share on other sites More sharing options...
rallokkcaz Posted September 2, 2006 Author Share Posted September 2, 2006 ok i need help with this ???????????????????? :(i can't get it to workwhen i link the to the user profilethe page shows blank?some one helphere's the page [url=http://www.pokebash.com/user.php]http://www.pokebash.com/user.php[/url]and the code[code]<?phpinclude ("config.php");//###########################################################if($_GET['uid']) { $sql['userdata'] = mysql_query("SELECT * FROM pokebash_users WHERE maaking_users='".$_GET['uid']."' "); //########IF USERID EXISTS##### if(mysql_num_rows($sql['userdata'])>0) { $sql['userdata'] = mysql_fetch_array($sql['userdata']); //######GET & DISPLAY SOME USER DATA##### $username = $sql['userdata']['username']; $email = $sql['userdata']['email']; echo $username .''. $email; } //#####USER DOESN'T EXIST###### else { echo 'This user is not in our database'; } }//#########REDIRECT IF UID IS NOT IN THE URL######### else { echo '<meta http-equiv="refresh" content="0;URL=user.php" />'; }?>[/code] Quote Link to comment Share on other sites More sharing options...
w32 Posted September 2, 2006 Share Posted September 2, 2006 questions the 'maaking_users' field contains the users id or their username??if it does contain the userid browsing user.php?uid=1 or any id that's actually in the dbase should bring out your user's info :) Quote Link to comment Share on other sites More sharing options...
w32 Posted September 2, 2006 Share Posted September 2, 2006 better yet give me allllll the fields in your database and info of what they contain, and I'll make you a working script :) 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.