PDA

View Full Version : Errors :(



Colin-Roberts
03-02-2008, 01:15 AM
Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /var/www/include/database.php on line 207

Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /var/www/include/database.php on line 218
207:

$this->num_active_users = mysql_numrows($result);
218:

$this->num_active_guests = mysql_numrows($result);

chrisgocrazyH
03-02-2008, 01:31 AM
try backing up the file then deleting them 2 lines sometimes works for me :D

Colin-Roberts
03-02-2008, 01:49 AM
That won't work.

chrisgocrazyH
03-02-2008, 02:43 AM
does for me sometimes?

what is this for?

Invent
03-02-2008, 02:58 AM
The function is mysql_num_rows not mysql_numrows...

QuickScriptz
03-02-2008, 05:54 AM
The function is mysql_num_rows not mysql_numrows...

By the looks of things he's using classes therefore it might be the correct spelling (he may have made his own function and spelt it that way).... look into that perhaps? If that is not infact the problem then try turning on mysql errors or make your queries/num rows look like this:


<?php
$test = mysql_query("SELECT * FROM `db`") or die(mysql_error());
$test2 = mysql_num_rows($test) or die(mysql_error());
?>

That should print out the error if it is actually a problem with your query and not the rest of your code :)

Colin-Roberts
03-02-2008, 01:16 PM
How come since i fixed the error the form no longer shows..
http://206.123.88.22/register.php

<?
include("include/session.php");
?>

<html>
<title>Registration Page</title>
<body>

<?
if($session->logged_in){
echo "<h1>Registered</h1>";
echo "<p>We're sorry <b>$session->username</b>, but you've already registered. "
."</p>";
}
else if(isset($_SESSION['regsuccess'])){
/* Registration was successful */
if($_SESSION['regsuccess']){
echo "<h1>Registered!</h1>";
echo "<p>Thank you <b>".$_SESSION['reguname']."</b>, your information has been added to the database, "
."</p>";
}
/* Registration failed */
else{
echo "<h1>Registration Failed</h1>";
echo "<p>We're sorry, but an error has occurred and your registration for the username <b>".$_SESSION['reguname']."</b>, "
."could not be completed.<br>Please try again at a later time.</p>";
}
unset($_SESSION['regsuccess']);
unset($_SESSION['reguname']);
}
else{
?>

<h1>Register</h1>
<?
if($form->num_errors > 0){
echo "<td><font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font></td>";
}
?>
<form action="process.php" method="POST">
<table align="left" border="0" cellspacing="0" cellpadding="3">
<tr><td>Username:</td><td><input type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>"></td><td><? echo $form->error("user"); ?></td></tr>
<tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>"></td><td><? echo $form->error("pass"); ?></td></tr>
<tr><td>Email:</td><td><input type="text" name="email" maxlength="50" value="<? echo $form->value("email"); ?>"></td><td><? echo $form->error("email"); ?></td></tr>
<tr><td colspan="2" align="right">
<input type="hidden" name="subjoin" value="1">
<input type="submit" value="Join!"></td></tr>
<tr><td colspan="2" align="left"><a href="index.php">Back to Main</a></td></tr>
</table>
</form>
<?
}
?>

</body>
</html>

Want to hide these adverts? Register an account for free!