Immortal55 Posted January 26, 2007 Share Posted January 26, 2007 This is the error that I keep getting....[b]Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/theblizz/public_html/whitedevil/calendertest.php on line 13[/b]I do not understand, I even copied the code from the page and pasted it and it still is giving me this error!Here is the code (I know I spelled calendar wrong, but that is how it is.):PHP code:[code=php:0]function getEventDays($month, $year) { $days = array(); $sql = mysql_query("SELECT DAY(event_date) AS day, COUNT(event_id) FROM calender_events WHERE MONTH(event_date) = " . $month . " AND YEAR(event_date) = " . $year . " GROUP BY day"); if (mysql_num_rows($sql) > 0) { while ($row = mysql_fetch_array($sql)) $days[] = $row['day']; } return $days; } [/code]One last thing the $_GET where exactly is it getting the year and month from???Thank you in advance.Also, this is all pertaining to the ([url=http://www.phpfreaks.com/tutorial_cat/29/Calendars--Date-&-Time.php]http://www.phpfreaks.com/tutorial_cat/29/Calendars--Date-&-Time.php[/url]) calendar tutorial here on the PHP freaks website. Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 26, 2007 Share Posted January 26, 2007 Do this:$q = "SELECT DAY(event_date) AS day, COUNT(event_id) FROM calender_events WHERE MONTH(event_date) = " . $month . " AND YEAR(event_date) = " . $year . " GROUP BY day";$sql = mysql_query($q) OR die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
Immortal55 Posted January 26, 2007 Author Share Posted January 26, 2007 Ah, thank you for that.That got me over one hurdle, but now I am getting an SQL error:[b]You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(event_date) AS day, COUNT(event_id) FROM calender_events WHERE[/b]What in the world should I change there, as far as I know that should be perfect... Quote Link to comment Share on other sites More sharing options...
micmania1 Posted January 26, 2007 Share Posted January 26, 2007 [quote author=jesirose link=topic=124194.msg514235#msg514235 date=1169840743]Do this:$q = "SELECT DAY(event_date) AS day, COUNT(event_id) FROM calender_events WHERE MONTH(event_date) = " . $month . " AND YEAR(event_date) = " . $year . " GROUP BY day";$sql = mysql_query($q)[b] OR die(mysql_error())[/b];[/quote]For this error I would change that because it's probably an error with the query's values.$sql = mysql_query($q);echo $q.'<br>'.mysql_query();Once youve found the error, delete the second line. Always helps me find my errors. Quote Link to comment Share on other sites More sharing options...
Immortal55 Posted January 26, 2007 Author Share Posted January 26, 2007 Well, that gave me more errors, now I have this one:[b]Warning: Wrong parameter count for mysql_query() in /home/theblizz/public_html/whitedevil/calendertest.php on line 14SELECT DAY(event_date) AS day, COUNT(event_id) FROM calender_events WHERE MONTH(event_date) = 01 AND YEAR(event_date) = 2007 GROUP BY dayWarning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/theblizz/public_html/whitedevil/calendertest.php on line 16[/b] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.