473,380 Members | 1,087 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,380 software developers and data experts.

mysql_num_rows(): supplied argument is not a valid MySQL result resource

I've got the following error:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/wbdfdart/public_html/wbdfforum/verwijder.php on line 13

verwijder.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
include "connect.php";

if (isset ($cat) AND isset ($topic) AND isset ($message)) {
$query = "SELECT user FROM reply WHERE id='$message'";
$exec = mysql_query($query);
$result = mysql_fetch_array($exec);
$owner = $result["user"];

$moderator_check_query = "SELECT * FROM moderator WHERE category=$cat AND user=$myid";
$moderator_check_exec = mysql_query($moderator_check_query);
$moderator_result = mysql_num_rows($moderator_check_exec);

if ($moderator_result == 1 OR $owner == $myid) {
$moderator = 1;
}

else {
$moderator = 0;
}

if ($moderator == 1) {
$replydelete_query="DELETE FROM reply WHERE id ='$id'";
mysql_query($replydelete_query) or die(mysql_error());
$topicmineen_query="UPDATE topic SET replies='replies -1' WHERE id='$topic'";
mysql_query($topicmineen_query) or die(mysql_error());
echo "<script>location.href='index.php?cat=".$cat."&top ic=".$topic."&page=".$page."'</script>";

}

else {
echo "<script>location.href='index.php?cat=".$cat."&top ic=".$topic."&page=".$page."'</script>";
}}
?>



What i did wrong?
Jul 17 '05 #1
5 21524
Try this in line 10

$moderator_check_query = "SELECT * FROM moderator WHERE category='$cat'AND user='$myid'";

Jul 17 '05 #2
[ Followup-To comp.lang.php ]

Arjan wrote:
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>

[big snip]

This does not look like php to me.
check the return value from mysql_query().

<?php
$sql = "select col1, col2 from table where col3='XYZ'";
$result = mysql_query($sql) or die(mysql_error());
// ________________________^^^^^^^^^^^^^^^^^^^^^^_
// ...
?>
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Jul 17 '05 #3
What i did wrong?

Many things, probably.

http://nopaste.php.cd/5795

Let me know if it worked - untested.

A.

--
My homepage
http://antoniobonanno.debris.it/

My portfolios
http://www.debris.it/whois.php?i=6
http://www.usefilm.com/photographer/19053.html
http://www.photosig.com/go/users/view?id=99395
Jul 17 '05 #4
Ok

$moderator_check_query = "SELECT * FROM moderator WHERE category=" . $cat .
" AND user=" . $myid;

should be

$moderator_check_query = "SELECT * FROM moderator WHERE category=" . $cat .
" AND user='" . $myid."'";

or more simply
$moderator_check_query = "SELECT * FROM moderator WHERE category=' $cat' AND
user=' $myid' ";

Kman

"Plasson" <an****************************@email.it> wrote in message
news:aR*********************@news2.tin.it...
What i did wrong?

Many things, probably.

http://nopaste.php.cd/5795

Let me know if it worked - untested.

A.

--
My homepage
http://antoniobonanno.debris.it/

My portfolios
http://www.debris.it/whois.php?i=6
http://www.usefilm.com/photographer/19053.html
http://www.photosig.com/go/users/view?id=99395

Jul 17 '05 #5
Thanx!

"Kman" <km*********@yahoo.com> schreef in bericht
news:U0******************@news20.bellglobal.com...
Ok

$moderator_check_query = "SELECT * FROM moderator WHERE category=" . $cat .. " AND user=" . $myid;

should be

$moderator_check_query = "SELECT * FROM moderator WHERE category=" . $cat .. " AND user='" . $myid."'";

or more simply
$moderator_check_query = "SELECT * FROM moderator WHERE category=' $cat' AND user=' $myid' ";

Kman

"Plasson" <an****************************@email.it> wrote in message
news:aR*********************@news2.tin.it...
What i did wrong?

Many things, probably.

http://nopaste.php.cd/5795

Let me know if it worked - untested.

A.

--
My homepage
http://antoniobonanno.debris.it/

My portfolios
http://www.debris.it/whois.php?i=6
http://www.usefilm.com/photographer/19053.html
http://www.photosig.com/go/users/view?id=99395


Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Burton Figg | last post by:
Before I get in trouble, I have searched extensively for this one, in the PHP Docs, online etc. I have a simple page: <?php $un="jim"; $pw="jim"; $db="localhost";
3
by: petemaxi | last post by:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\Program Files\xampp\htdocs\tockholes\includes\menu.inc.php on line 9 <div class="left"> <div class="menu">...
11
by: Breana | last post by:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/breana/public_html/category.php on line 88 ------------------------------------------- It does this...
5
by: Mubs | last post by:
Hi, I 'am trying to connect my sql database with my webpage for users log in. i have got this script so far but i keep getting the following error message which i cannot figure out.. could any1...
4
by: fisherd | last post by:
When i run this code, i keep getting this message; Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\wamp\www\checklogin.php on line 26 i use this code to...
2
by: poreko | last post by:
I am connecting to my database using Object oriented PHP. My query is returning results but at the end of my table,at the bottom of the page I keep having this error when I run my program: Warning:...
4
by: kalyanip14 | last post by:
Hi I am new to Php.I am trying to read My sql database data from table to php. I am getting this warning Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource ...
1
by: byteit101 | last post by:
I was working with OOP, and was testing a sql result class, but it gives me the following error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource. I think it has...
2
by: macdalor | last post by:
Hi! I'm completely new to all dev and trying to put a website together using MySQLI and PHP; was running fine until I try to gather the DB content with the following script: <?...
9
by: Cxsey | last post by:
I get the following error code using this code: "Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource" It's on line 55 in this php script: <?php /** *...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.