chriscloyd Posted May 30, 2006 Share Posted May 30, 2006 i get this error when i ahve this codeWarning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/chris/public_html/index.php on line 199Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253[code]<?mysql_select_db($database_localhost, $localhost);$query_archives = "SELECT date_format(date, '%Y-%c-%e') as ArticleDate FROM articles";$archives = mysql_query($query_archives, $localhost) or die(mysql_error());$row_archives = mysql_fetch_assoc($archives);$totalRows_archives = mysql_num_rows($archives);?><?php function build_calendar($month,$year,$day) { /* Declaring the variables */ $daysOfWeek = array('Su','Mo','Tu','We','Th','Fr','Sa'); $firstDayOfMonth = mktime(0,0,0,$month,1,$year); $noDays = date('t',$firstDayOfMonth); $dateComponents = getdate($firstDayOfMonth); $dayOfWeek = $dateComponents['wday']; $monthName = date('F',mktime(0,0,0,$month,1,$year)); global $rsArticleDates; global $_GET; if (mysql_num_rows($archives) > 0){ mysql_data_seek($archives,0); while($row_archives = mysql_fetch_assoc($archives)){ $dates[] = $row_archivess['date']; } } /* Computing the previous month. */ if($month == 1) { $mn=12; $yn=$year-1; } else { $mn=$month-1; $yn=$year; } /* Computing the next month. */ if($month == 12) { $mn2=1; $yn2=$year+1; } else { $mn2=$month+1; $yn2=$year; } /* Calendar header: next and previous month links */ $calendar = "<table>"; $calendar .= "<tr><td><a href=day.php?m=$mn&y=$yn&d=$day><</a></td>"; $calendar .="<td colspan=5 align=center>$monthName, $year</td>"; $calendar .="<td><a href=day.php?m=$mn2&y=$yn2&d=$day>></a></td></tr>"; $calendar .="<tr>"; /* Calendar header: Display the days of the week */ foreach($daysOfWeek as $day) { $calendar .= "<td>$day</td>"; } $calendar .= "</tr>"; $calendar .= "<tr>"; $currentDay = 1; /* Fill in the beginning of the calendar body */ if ($dayOfWeek > 0) { $calendar .= "<td colspan='$dayOfWeek'> </td>"; } /* Generate the calendar body */ while ($currentDay <= $noDays) { if ($dayOfWeek == 7) { $dayOfWeek = 0; $calendar .= "</tr><tr>"; } $date = $year."-".$month."-".$currentDay; if (in_array($date,$dates)) { $calendar .= "<td><a href='day.php?m=$month&y=$year&d=$currentDay'>$currentDay</a></td>"; } else { $calendar .= "<td>$currentDay</td>"; } $currentDay++; $dayOfWeek++; } /* Filling in the end of the calendar body */ if ($dayOfWeek != 7) { $remainingDays = 7 - $dayOfWeek; $calendar .= "<td colspan='$remainingDays'> </td>"; } $calendar .= "</table>"; return $calendar;} if (isset($_GET['m']) && isset($_GET['y']) && isset($_GET['d'])){ $month = $_GET['m']; $year = $_GET['y']; $day = $_GET['d'];} else { $dateComponents = getdate(); $month = $dateComponents['mon']; $year = $dateComponents['year']; $day = $dateComponents['mday'];}echo build_calendar($month,$year,$day); ?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/10758-clander/ Share on other sites More sharing options...
Zane Posted May 30, 2006 Share Posted May 30, 2006 [!--coloro:#999999--][span style=\"color:#999999\"][!--/coloro--]Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/chris/public_html/index.php on line 199[!--colorc--][/span][!--/colorc--]Your mysql_num_rows obviously failed which, according to your code, would skip the $dates creationSo you technically have no variable $dates if mysql_num_rows() failed explaining this error[!--coloro:#C0C0C0--][span style=\"color:#C0C0C0\"][!--/coloro--]Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253[!--colorc--][/span][!--/colorc--]which you posted ...... many many times in a rowSo the key is to fix your mysql_num_rows....check your MySQL result resource...which is $query_archives, AKA your queryand make sure that your date field in your database is of the DATE/DATETIME datatype Quote Link to comment https://forums.phpfreaks.com/topic/10758-clander/#findComment-40188 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.