0

Hi,

I used the code

<?php
$con = mysql_connect("localhost","clickim_forum","thankyou1");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("clickim_forum", $con);

$result = mysql_query("SELECT userid FROM user ORDER BY userid DESC LIMIT 0,1");

echo "<table border='0'>";
echo "<tr>";
while(row = mysql_fetch_array($result))
  {
  echo "<td style='color:#FF0000 '>" . $row['userid'] . "</td>";
  } 
    {
  echo "<td>Users Online & counting. Are you one of them?</td>";
  }
  {
  echo "</tr>";
  }
echo "</table>";

mysql_close($con);
?>

to show the total registered members on a vBulletin forum. But Now I have upgraded my server and it stopped working and now its giving me error

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/clickim/public_html/1.php on line 14

Please help.

3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by faroukmuhammad
0

Change

$result = mysql_query("SELECT userid FROM user ORDER BY userid DESC LIMIT 0,1");

to

$result = mysql_query("SELECT userid FROM user ORDER BY userid DESC LIMIT 0,1") or die(mysql_error());

and you should see an SQL error.
If you can't solve the error, just post it back here.

0

I get this error now

Parse error: syntax error, unexpected '=' in /home/clickim/public_html/1.php on line 14
0

Sarao, there was mistake (or lets say typographical error) you made in line 14. The variable row has no dollar sign...
change

while(row = mysql_fetch_array($result))

to

while($row = mysql_fetch_array($result))

Edited by faroukmuhammad: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.