Jump to content

Recommended Posts

Can someone show me what the error in this is.

Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource n /public_html/venues/venues.php on line 23 This is line 23 $num=mysql_numrows($result);

NO Vemues Schedule

$query = 'DELETE FROM Venues WHERE DATE_SUB(CURDATE(),INTERVAL 1 DAY) >= `Date1`'; 
mysql_query($query);
$query= 'SELECT venues_field_1, venues_field_2, venues_field_3, venues_field_4, venues_field_5, venues_field_6, venues_field_7, venues_field_8. venues_field_9, venues_field_10, venues_field_11, venues_field_12, venues_field_13, venues_field_14, venues_field_15 FROM Venues ORDER BY venues_field_1 DESC LIMIT 0, 100';

$result=mysql_query($query);

$num=mysql_numrows($result);

if ($num==0) {
echo "<b>NO Vemues Schedule</b><br>";
}else{
echo "<b>Where We Are</b><br>";
}

mysql_close();

$i=0;
while ($i < $num) {

$venues_field_1=mysql_result($result,$i,"venues_field_1");
$venues_field_2=mysql_result($result,$i,"venues_field_2");
$venues_field_3=mysql_result($result,$i,"venues_field_3");
$venues_field_4=mysql_result($result,$i,"venues_field_4");
$venues_field_5=mysql_result($result,$i,"venues_field_5");
$venues_field_6=mysql_result($result,$i,"venues_field_6");
$venues_field_7=mysql_result($result,$i,"venues_field_7");
$venues_field_8=mysql_result($result,$i,"venues_field_8");
$venues_field_9=mysql_result($result,$i,"venues_field_9");
$venues_field_10=mysql_result($result,$i,"venues_field_10");
$venues_field_11=mysql_result($result,$i,"venues_field_11");
$venues_field_12=mysql_result($result,$i,"venues_field_12");
$venues_field_13=mysql_result($result,$i,"venues_field_13");
$venues_field_14=mysql_result($result,$i,"venues_field_14");
$venues_field_15=mysql_result($result,$i,"venues_field_15");

echo "<b>$venues_field_1<br>$venues_field_2 - $venues_field_3</b><br>$venues_field_4<br>$venues_field_5<br>$venues_field_6<br>$venues_field_7<br>$venues_field_8<br>$venues_field_9<br>$venues_field_10<br>$venues_field_11<br>$venues_field_12<br>$venues_field_13<br>$venues_field_14<br>$venues_field_15<br>";

$i++;
}

 

 

Link to comment
https://forums.phpfreaks.com/topic/158938-mysql_numrows-error/
Share on other sites

More than likely your query is failing.  Change this line to this and post the output:

 

$result=mysql_query($query) or die(mysql_error());

 

(I think you "mysql_numrows" and "mysql_num_rows" are the same, but the second one is more popular IMO.)

Link to comment
https://forums.phpfreaks.com/topic/158938-mysql_numrows-error/#findComment-838259
Share on other sites

Can someone show me what the error in this is.

Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource n /public_html/venues/venues.php on line 23 This is line 23 $num=mysql_numrows($result);

NO Vemues Schedule

$query = 'DELETE FROM Venues WHERE DATE_SUB(CURDATE(),INTERVAL 1 DAY) >= `Date1`'; 
mysql_query($query);
$query= 'SELECT venues_field_1, venues_field_2, venues_field_3, venues_field_4, venues_field_5, venues_field_6, venues_field_7, venues_field_8. venues_field_9, venues_field_10, venues_field_11, venues_field_12, venues_field_13, venues_field_14, venues_field_15 FROM Venues ORDER BY venues_field_1 DESC LIMIT 0, 100';

$result=mysql_query($query);

$num=mysql_numrows($result);

if ($num==0) {
echo "<b>NO Vemues Schedule</b><br>";
}else{
echo "<b>Where We Are</b><br>";
}

mysql_close();

$i=0;
while ($i < $num) {

$venues_field_1=mysql_result($result,$i,"venues_field_1");
$venues_field_2=mysql_result($result,$i,"venues_field_2");
$venues_field_3=mysql_result($result,$i,"venues_field_3");
$venues_field_4=mysql_result($result,$i,"venues_field_4");
$venues_field_5=mysql_result($result,$i,"venues_field_5");
$venues_field_6=mysql_result($result,$i,"venues_field_6");
$venues_field_7=mysql_result($result,$i,"venues_field_7");
$venues_field_8=mysql_result($result,$i,"venues_field_8");
$venues_field_9=mysql_result($result,$i,"venues_field_9");
$venues_field_10=mysql_result($result,$i,"venues_field_10");
$venues_field_11=mysql_result($result,$i,"venues_field_11");
$venues_field_12=mysql_result($result,$i,"venues_field_12");
$venues_field_13=mysql_result($result,$i,"venues_field_13");
$venues_field_14=mysql_result($result,$i,"venues_field_14");
$venues_field_15=mysql_result($result,$i,"venues_field_15");

echo "<b>$venues_field_1<br>$venues_field_2 - $venues_field_3</b><br>$venues_field_4<br>$venues_field_5<br>$venues_field_6<br>$venues_field_7<br>$venues_field_8<br>$venues_field_9<br>$venues_field_10<br>$venues_field_11<br>$venues_field_12<br>$venues_field_13<br>$venues_field_14<br>$venues_field_15<br>";

$i++;
}

 

 

 

You have a very basic (and relatively obvious) syntax error in your query: a period where a comma should be. Use this:

 

$query= 'SELECT venues_field_1, venues_field_2, venues_field_3, venues_field_4, venues_field_5, venues_field_6, venues_field_7, venues_field_8, venues_field_9, venues_field_10, venues_field_11, venues_field_12, venues_field_13, venues_field_14, venues_field_15 FROM Venues ORDER BY venues_field_1 DESC LIMIT 0, 100';

 

Also, the function is mysql_num_rows(), not mysql_numrows (although, apparently the latter works also).

Link to comment
https://forums.phpfreaks.com/topic/158938-mysql_numrows-error/#findComment-838260
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.