Jump to content

help me get started please


oldspicelong

Recommended Posts

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

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
  
        }

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']

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.