help with users/members script

when clicking on the users link it displays no users but if you do it like this http://mysite.com/profile.php?id=415 it displays peoples profile. so how do i fix this problem.

[php]<?php
include (“session.php”);
include (“includes/db.php”);
?>

All Users
<?php include ("includes/nav_bar.php");?>

Users


<?php $result=mysql_query("select count(*) from users"); $row=mysql_fetch_row($result); $tr=$row[0]; $rpp=10;

$pn=1;

if(isset($_GET[‘pn’]))
{
$pn=$_GET[‘pn’];
}
$tp=($tr/$rpp);

if($tr%$rpp>0)
{
$tp++;
}
$from=(($pn-1)$rpp)+1;
$to=($pn)
($rpp);
$result=mysql_query(“select * from users where uid between $from and $to”);
while($row=mysql_fetch_row($result))
{
$userid=$row[0];
$lowercase = strtolower($row[3]);

$image = md5($lowercase);

echo “

”;
echo “
”;
echo “
”;

if($uid==$userid)
{
echo “

You !
”;
}
else
{
$f_command="select * from follow_user WHERE uid_fk=’$uid’ and following_uid=’$userid’ ";
$user_sql=mysql_query($f_command);
$count=mysql_num_rows($user_sql);
if($count==0)
{
echo "“;
echo”";
}
else
{
echo "“;
echo”";
}
}

echo “

”;
echo “”;
echo “
”;
}
echo “
    ”;
    for($i=1;$i<=$tp;$i++)
    {
    echo “
  • $i
  • ”;
    }
    echo “
”;

?>


© Yepinol (Yepinol.com)
[/php]

Which link are you talking about this one?

[php]echo “

$row[1]
”;[/php]

And if you right click on the link and select “Copy Link Address” and paste it, what does it show?

for example this will take me to my profile http://mysite.co.uk/profile.php?id=415
but if i click on the members/users it will display no members

You didn’t answer my question :frowning:

sorry

http://mysite.co.uk/show_user.php

[php]<?php
include (“session.php”);
include (“includes/db.php”);
?>

All Users
<?php include ("includes/nav_bar.php");?>

Users


<?php $result=mysql_query("select count(*) from users"); $row=mysql_fetch_row($result); $tr=$row[0]; $rpp=10;

$pn=1;

if(isset($_GET[‘pn’]))
{
$pn=$_GET[‘pn’];
}
$tp=($tr/$rpp);

if($tr%$rpp>0)
{
$tp++;
}
$from=(($pn-1)$rpp)+1;
$to=($pn)
($rpp);
$result=mysql_query(“select * from users where uid between $from and $to”);
while($row=mysql_fetch_row($result))
{
$userid=$row[0];
$lowercase = strtolower($row[3]);

$image = md5($lowercase);

echo “

”;
echo “
”;
echo “
”;

if($uid==$userid)
{
echo “

You !
”;
}
else
{
$f_command="select * from follow_user WHERE uid_fk=’$uid’ and following_uid=’$userid’ ";
$user_sql=mysql_query($f_command);
$count=mysql_num_rows($user_sql);
if($count==0)
{
echo "“;
echo”";
}
else
{
echo "“;
echo”";
}
}

echo “

”;
echo “”;
echo “
”;
}
echo “
    ”;
    for($i=1;$i<=$tp;$i++)
    {
    echo “
  • $i
  • ”;
    }
    echo “
”;

?>


© Yepinol (Yepinol.com)
[/php]

Are you sure that’s what it shows…

[php]http://mysite.co.uk/show_user.php[/php]

Nothing in the code you posted will generate the link above.

yeah the proper link http://latenightchat.co.uk/show_user.php

any ideas

I meant…

[php] for($i=1;$i<=$tp;$i++)
{
echo “

  • $i
  • ”;
    }[/php]

    See how you have the pn= a number after it?

    The link you posted don’t have a number after it, that’s why I think you’re not posting the right link, or the right code.

    you try with

    http://latenightchat.co.uk

    username = demo

    password = demo

    i will delete the account once you checked it

    When I clicked on the link of the user “Demo” in red below

    demo post
    LIKE | Comment | 3 minutes ago

    I was taken here

    http://latenightchat.co.uk/profile.php?id=418

    Isn’t that correct?

    Ok I got the problem after I posted a comment… Give me a sec…

    once that page loads. At the top click on the users link and that is the link i am refering to

    Change:

    [php]echo “

    $row[1]
    ”;[/php]

    To:

    [php]echo “

    $row[1]
    ”;
    [/php]

    blank page

    Also can you post the code to showusers.php

    You also got a bug where you add a new “status update” then hover over your User ID, it doesn’t have your user ID.

    [php]<?php
    include (“session.php”);
    include (“includes/db.php”);
    ?>

    All Users
    <?php include ("includes/nav_bar.php");?>

    Users


    <?php $result=mysql_query("select count(*) from users"); $row=mysql_fetch_row($result); $tr=$row[0]; $rpp=10;

    $pn=1;

    if(isset($_GET[‘pn’]))
    {
    $pn=$_GET[‘pn’];
    }
    $tp=($tr/$rpp);

    if($tr%$rpp>0)
    {
    $tp++;
    }
    $from=(($pn-1)$rpp)+1;
    $to=($pn)
    ($rpp);
    $result=mysql_query(“select * from users where uid between $from and $to”);
    while($row=mysql_fetch_row($result))
    {
    $userid=$row[0];
    $lowercase = strtolower($row[3]);

    $image = md5($lowercase);

    echo “

    ”;
    echo “
    ”;
    echo “
    ”;

    if($uid==$userid)
    {
    echo “

    You !
    ”;
    }
    else
    {
    $f_command="select * from follow_user WHERE uid_fk=’$uid’ and following_uid=’$userid’ ";
    $user_sql=mysql_query($f_command);
    $count=mysql_num_rows($user_sql);
    if($count==0)
    {
    echo "“;
    echo”";
    }
    else
    {
    echo "“;
    echo”";
    }
    }

    echo “

    ”;
    echo “”;
    echo “
    ”;
    }
    echo “
      ”;
      for($i=1;$i<=$tp;$i++)
      {
      echo “
    • $i
    • ”;
      }
      echo “
    ”;

    ?>


    © Abhishek Ahlawat (tuts.Wtfdiary.com)
    [/php]

    Try This…

    Change:
    [php]$result=mysql_query(“select * from users where uid between $from and $to”);[/php]

    To:
    [php]$result=mysql_query(“select * from users limit $from ,10”);[/php]

    or this, but you’ll have to keep incrementing the “1” to get the next 10.

    [php]$result=mysql_query(“select * from users limit 1,10”);[/php]

    try using the limit to display 10 at a time, because the uid’s might not be sequential in your database.

    Sponsor our Newsletter | Privacy Policy | Terms of Service