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.

Recommended Answers

All 3 Replies

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.

I get this error now

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

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))
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.