I get the error Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in stuff/stuff/stuff/stuff/stuffyoucantsee/login.php on line 92
<?
include 'config.php';
session_start();
if($_SESSION['s_logged_n'] == 'true'){
$query="SELECT * FROM Users";
$result=mysql_query($query);
$num=mysql_numrows($result);
$i=0;
while ($i < $num) {
$current_zg=mysql_result($result,$i,"ZG");
$current_username=mysql_result($result,$i,"Username");
$i++;
}
echo ('Username:');
echo($current_username);
echo('ZanaGold:');
echo($current_zg);
echo('Current Pet:');
} else {
echo ('You cannot access this information unless you are logged in. <a href="login.php">Click here</a> to login.');
}?>
</div></td>
</tr>
<tr>
<td height="289" colspan="2">
<div align="center">Login to your Zanapets account<br>
<?php
session_start();
include 'config.php';
if(isset($_POST['login']))
{
$username = $_POST[$username];
$password = $_POST[$password];
$query = mysql_query("SELECT * FROM Users WHERE Username = '$username' AND Password = '$password' LIMIT 1") or die(mysql_error());
mysql_query($query);
$row = mysql_fetch_array($query);
}
// now we check if they are activated
if(mysql_num_rows($query) > 0)
{
if($row['Activated'] > 0)
{
plz help!
$_SESSION['s_logged_n'] = 'true';
$_SESSION['s_username'] = $username;
$_SESSION['s_name'] = $row['Name'];
header("Location: member.php");
} else {
echo ('Sorry, we couldnt log you on. Your account may not be active. Please check your email for the activation code. Or, <a href=\"resend.php\">click here</a> to resend the activation code.<br><br>Or, the information you just put in is wrong. <a href="\login.php\">Click here</a> to go back and try again.');
}
}
?>