[In reply to earlier thread]

OK,... I have an error in the second for loop, and the 2 for loops have the same exact code in them. This is the error I get :

Warning: Supplied argument is not a valid MySQL result resource in /home/levxnet/public_html/forum/postview.php on line 90

Perhaps that could clear some things up? (Line 90 is pointed to)


for($count=20; $count>=$last; $count--)
{
echo "<TR>";
$sql=mysql_query("SELECT FROM users WHERE name='$post[$count][user]'", $connect);
$user=mysql_fetch_array($sql);
$sql2=mysql_query("SELECT number FROM posts WHERE user='$post[$count][user]'", $connect);
$totalposts=mysql_num_rows($sql2);
echo "<TD WIDTH='30%'>".$post[$count][user]."<BR>".$user[status]."<BR>".$totalposts."<BR>".dconvert($post[$count][date]);
echo "</TD><TD WIDTH='70%'>".$post[$count][post]."</TD></TR><BR>";
if($count == $last)
{
echo "</TABLE>";
}
}
}
if($page == 1)
{
for($count=$first; $count>=$last; $count--)
{
echo "<TR>";
$sql=mysql_query("SELECT
FROM users WHERE name='$post[$count][user]'", $connect);
(LINE 90)$user=mysql_fetch_array($sql);
$sql2=mysql_query("SELECT number FROM posts WHERE user='$post[$count][user]'", $connect);
$totalposts=mysql_num_rows($sql2);
echo "<TD WIDTH='30%'>".$post[$count][user]."<BR>".$user[status]."<BR>".$totalposts."<BR>".dconvert($post[$count][date]);
echo "</TD><TD WIDTH='70%'>".$post[$count][post]."</TD></TR><BR>";
if($count == $last)
{
echo "</TABLE>";
}
}
}

    before you do this:
    (LINE 90)$user=mysql_fetch_array($sql);

    you need to actually "Execute" the SQL query. so only then you can get the result row. add this code before the above line:

    $result = mysql_query($sql);
    then you can do:
    (LINE 90)$user=mysql_fetch_array($result);

      I think that means you are not getting any valid results from your $sql query. Therefore, when you try to convert it to an array, you get an error. try just the query it self and find out how many rows are affected.

        um - I think he did execute the query... no?

        $sql=mysql_query("SELECT * FROM users WHERE name='$post[$count][user]'", $connect);

        looks like an executed query to me...

          ah forget it =P

          i used the wrong freakin column name

          ugh,... im such an idiot. how come all these frustrating, yet stupid things happen to me? i could have finished Level-X by now if it werent for such blindness

            Write a Reply...