I have a friends script, I need to display this user's friend’s page. There is a database frnds , and in it the fields id , user_one , user_two . There is a page http://test1.ru/friends/?id=1 there everything shows perfectly, and on http://test1.ru/id1 it shows all users of the same friend.

 <?php ... $query = "SELECT user_one, user_two FROM frnds WHERE user_one = '$myrow2[id]' OR user_two = '$myrow2[id]'"; $frnd_query = mysql_query($query); while ($run_frnd = mysql_fetch_array($frnd_query)){ $user_one = $run_frnd['user_one']; $user_two = $run_frnd['user_two']; if ($user_one == $myrow2['id']) { $id = $user_two; } else{ $id = $user_one; } $username = getuser($id, 'username'); $family = getuser($id,'family'); $avatar = getuser($id,'avatar'); echo "<a href='/id$id'><div id='textop'>$username $family</div> "; echo "<img src='/".$avatar."' width=110px border=0px><br/></a>"; } ?> 
  • you and should not work. read more about CNC - sinedsem
  • deprecated This extension is deprecated since PHP 5.5.0 and will be removed in the future. Use MySQLi or PDO_MySQL instead. See also the MySQL instruction: API selection and the corresponding FAQ for more details. Alternatives to this function: mysqli_connect () PDO :: __ construct () - zb '

1 answer 1

You probably have no server-level rewrite conversion of http://test1.ru/id1 to http://test1.ru/friends/?id=1 . Therefore, the GET id parameter is left empty or gets the default value in the script. Therefore, when using an alternate URL, you always get the same user.