oldspicelong Posted August 4, 2009 Share Posted August 4, 2009 Ok i want to create a script that displays all the users in my database and when someone clicks on one of the users listed it then displays certain variables that i want to be displayed for example if i have a user named "usera" and i click on that name i want it to display things that only go with that user like display age and stuff without having to to redirect to a different webpage Link to comment https://forums.phpfreaks.com/topic/168868-help-me-get-started-please/ Share on other sites More sharing options...
oldspicelong Posted August 4, 2009 Author Share Posted August 4, 2009 i forgot to add this. this is the script im starting from if(!isset($_GET['user'])) { echo "Select a name to view there ninja card.<br><br>"; $NPCS = mysql_query("SELECT * FROM `users`"); while($Show = mysql_fetch_array($NPCS)) { echo "<a href=\"ninjacardone.php? Action=view&user=" . $Show['username'] . "\">" . $Show['username'] . "</a><br>"; } exit(); } $NPC = mysql_escape_string($_GET['user']); $username = $NPCS; ($_GET[Action] = view=) { while($row = mysql_fetch_array($sql)) { echo "Name:".$row['username']."<br/>"; echo "Level:".$row['level']."<br/>"; echo "Health:".$row['health']."/".$row['max_health']." <br/>"; echo "Chakra:".$row['chakra']."/".$row['maxchakra']."<br/>"; echo "Rank:".$row['rank']."<br/>"; echo "Kekkei Genkai:".$row['bloodline']."<br/>"; echo "Village:".$row['village']."<br/><br/>"; // Then just carry on } Link to comment https://forums.phpfreaks.com/topic/168868-help-me-get-started-please/#findComment-890984 Share on other sites More sharing options...
nomis Posted August 5, 2009 Share Posted August 5, 2009 Getting information about all users and one user would require different code; if it were me I'd create a different page for viewing information about single users. Since you have this line echo "<a href=\"ninjacardone.php? Action=view&user=" . $Show['username'] . "\">" . $Show['username'] . "</a><br>"; why not edit it to something like this: echo '<a href="ninjacardoneedit.php?username='. $row['username]. '> Edit</a><br>' ; This way these variables will be passed to the URL, and you can grab them on the next page with a $_GET['username'] Link to comment https://forums.phpfreaks.com/topic/168868-help-me-get-started-please/#findComment-890992 Share on other sites More sharing options...
oldspicelong Posted August 5, 2009 Author Share Posted August 5, 2009 i dont want to edit any of the information i just want to be able to allow other users to see some information about other users Link to comment https://forums.phpfreaks.com/topic/168868-help-me-get-started-please/#findComment-890997 Share on other sites More sharing options...
nomis Posted August 5, 2009 Share Posted August 5, 2009 okay... that was just an example. Instead of making the link "Edit" you could make it "view, and use the same information, rather than producing editable data, you could see information about that one user Link to comment https://forums.phpfreaks.com/topic/168868-help-me-get-started-please/#findComment-890998 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.