ok chaps and chapasses, heres the error:
mysql_num_rows(): supplied argument is not a valid MySQL result resource
and after the asterix is the code that is generating the error.
what I am doing is removing records from a table then selecting data from another table to see if that user has any more records with different names in the database. Now I know that SELECT is the only query that will return a result set, which is why its looking for affected rows.
I have a close after this for the simple reason I thought it might work if I close then re-open the connection as I have been getting the error without the close and re-open.
I have looked all over for the past five yours and its too late to keep lookin so I thought I would throw it open o the floor to see what you all thought so here goes:
********************************************************
<?
@$db = mysql_connect("servername", "username", "password" );
if (!$db)
{
/* redirect back to the admin panel page */
header("Location: ../adminpanel.php"
exit;
}
mysql_select_db("databasename"
list($name,$pet) = split ("/", $_POST['DELETE_ITEM_NAME']);
?>
<html>
<head>
<title>User Deletion</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META http-equiv="refresh" content="3;URL=../adminpanel.php">
</head>
<body>
<?
echo "<h1> Deleting...</h1><BR><BR>";
$query = "DELETE FROM pets WHERE user='$name' AND name='$pet'";
$result = mysql_query($query);
echo mysql_affected_rows()." Records deleted, Stage 1 clear...<BR><BR>";
//now check for them having another animal left in the table
mysql_close();
@$db = mysql_connect("servername", "user", "password" );
if (!$db)
{
/* redirect back to the admin panel page */
header("Location: ../adminpanel.php"
exit;
}
mysql_select_db("databasename"
$query2 = "SELECT * FROM pets WHERE username='".$name."'";
$result2 = mysql_query($query2);
$num_results2 = mysql_num_rows($result2);
echo $result2."Checking for other pets under this user...<BR><BR>";
if ($num_results2 == 0)
**********************************************
the script then goes on to inform the user if there is another record which at the moment it doesnt do as the number of results isnt set. And finally because there are no more results it clears the user out of the security table which then stops them loggin in for the other pets. Which totaly buggers up the system.
Heres hoping
cheers all and any who can help
'mi casa es su casa'
]-=tty0=-[
mysql_num_rows(): supplied argument is not a valid MySQL result resource
and after the asterix is the code that is generating the error.
what I am doing is removing records from a table then selecting data from another table to see if that user has any more records with different names in the database. Now I know that SELECT is the only query that will return a result set, which is why its looking for affected rows.
I have a close after this for the simple reason I thought it might work if I close then re-open the connection as I have been getting the error without the close and re-open.
I have looked all over for the past five yours and its too late to keep lookin so I thought I would throw it open o the floor to see what you all thought so here goes:
********************************************************
<?
@$db = mysql_connect("servername", "username", "password" );
if (!$db)
{
/* redirect back to the admin panel page */
header("Location: ../adminpanel.php"
exit;
}
mysql_select_db("databasename"
list($name,$pet) = split ("/", $_POST['DELETE_ITEM_NAME']);
?>
<html>
<head>
<title>User Deletion</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META http-equiv="refresh" content="3;URL=../adminpanel.php">
</head>
<body>
<?
echo "<h1> Deleting...</h1><BR><BR>";
$query = "DELETE FROM pets WHERE user='$name' AND name='$pet'";
$result = mysql_query($query);
echo mysql_affected_rows()." Records deleted, Stage 1 clear...<BR><BR>";
//now check for them having another animal left in the table
mysql_close();
@$db = mysql_connect("servername", "user", "password" );
if (!$db)
{
/* redirect back to the admin panel page */
header("Location: ../adminpanel.php"
exit;
}
mysql_select_db("databasename"
$query2 = "SELECT * FROM pets WHERE username='".$name."'";
$result2 = mysql_query($query2);
$num_results2 = mysql_num_rows($result2);
echo $result2."Checking for other pets under this user...<BR><BR>";
if ($num_results2 == 0)
**********************************************
the script then goes on to inform the user if there is another record which at the moment it doesnt do as the number of results isnt set. And finally because there are no more results it clears the user out of the security table which then stops them loggin in for the other pets. Which totaly buggers up the system.
Heres hoping
cheers all and any who can help
'mi casa es su casa'
]-=tty0=-[