Jump to content

viewing other members profile


CBaZ

Recommended Posts

*** = not sure what to place here yet.  i get the read out of all my usernames via the id but i need maybe another row in my table to make this work. please help me  :)

 

 

<?php

echo "</left><form name=\"profileview\" action=\"profile.php?user_id=***\" method=\"post\">\n";

echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";

echo "<tr>\n";

echo "<td>View:</td>\n";

echo "<td><select name=\"profile\">\n";

echo "<option value=\"\"></option>\n";

 

 

$sql = mysql_query("SELECT * FROM users WHERE user_id != '$_SESSION[id]' ORDER BY username");

if (mysql_num_rows($sql) > 0) {

  while ($x = mysql_fetch_assoc($sql)) echo "<option value=\"$x[user_id]\">$x[username]</option>\n";

}

 

echo "</td>\n";

echo "</tr>\n";

echo "<tr>\n";

echo "<td></td>\n";

echo "<td><input type=\"submit\" name=\"profileview\" value=\"View\" /></td>\n";

echo "</tr>\n";

echo "</table>\n";

echo "</form></left>\n";

 

?>

Link to comment
Share on other sites

<br>

<?php

$connect = mysql_connect("localhost", "user", "pw") or die("Could not connect to database: " . mysql_error());

mysql_select_db("db", $connect) or die("Could not select database");

$query = "SELECT * FROM users WHERE user_id != '$user_id' ORDER BY username"; 

$result = mysql_query($query, $connect) or die("QUERY FAILED: " . mysql_error());

$row = mysql_fetch_array($result,MYSQL_ASSOC);

print "<left><form name=\"profileview\" action=\"profile2.php?user_id=$row[user_id]\" method=\"post\">\n";

echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";

echo "<tr>\n";

echo "<td>View:</td>\n";

echo "<td><select name=\"profileview\">\n";

echo "<option value=\"\"></option></left>\n";

 

 

$sql = mysql_query("SELECT * FROM users WHERE user_id != '$_SESSION[id]' ORDER BY username");

if (mysql_num_rows($sql) > 0) {

  while ($x = mysql_fetch_assoc($sql)) echo "<option value=\"$x[user_id]\">$x[username]</option>\n";

}

 

echo "</td>\n";

echo "</tr>\n";

echo "<tr>\n";

echo "<td></td>\n";

echo "<td><input type=\"submit\" name=\"profileview\" value=\"View\" /></td>\n";

echo "</tr>\n";

echo "</table>\n";

echo "</form></left>\n";

 

?>

 

the question is that i can only get the current logged in user's id but i want it to be the user id matching the username that comes up from the pull down list.  the usernames show up but the user id won't be displayed when i select a username from the pulldown

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.