flash gordon Posted December 3, 2006 Share Posted December 3, 2006 Hi,This coding runs fine on my server and localhost, but when I throw it up on someone else server running PHP Version 4.4.4 I get errors:[code]<calendar year="2006">− <January><br/><b>Warning</b>: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in <b>/home/keyclub/public_html/calendar/events.php</b> on line <b>31</b><br/></January>− <February><br/><b>Warning</b>: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in <b>/home/keyclub/public_html/calendar/events.php</b> on line <b>31</b><br/></February>...truncated[/code]Here is my php script:[code=php:0]<?phpinclude("calendar_pass.php");//-------connect to databasemysql_connect("localhost", $username, $password) or die ("Could not connect to database");mysql_select_db($database) or die ("Could not select database");// set up yearif (isset($_GET['year'])) $year = $_GET['year'];else $year = date("Y");// MAKE THE XML DOCheader("Content-Type: application/xml; charset=ISO-8859-1");echo '<?xml version="1.0" encoding="iso-8859-1"?>' . "\n";echo '<calendar year="' . $year . '" >';for ($i=1; $i<13; $i++) {$month = $i;$query = "SELECT * FROM $table WHERE month='" . $month . "' AND year ='" . $year . "'";$myQuery = mysql_query($query);echo "<" . date("F", mktime(0, 0, 0, $month, 1, $year)) . ">"; // <January>while ($row = mysql_fetch_array($myQuery, MYSQL_BOTH ) ) { // <<<------LINE WITH THE ERROR echo '<event date="' . $row['day'] . '">'; // <event date="12"> echo '<bands headliner="' . $row['headliner'] . '" band2="' . $row['band2'] . '" band3="' . $row['band3'] . '" />'; echo '<tickets url="' . $row['tickets'] . '" />'; echo '<picture url="' . $row['picture'] . '" />'; echo '<links link1="' . $row['link1'] . '" link2="' . $row['link2'] . '" link3="' . $row['link3'] . '" />'; echo '<description text="' . $row['description'] . '" />'; echo '</event>'; }echo '</' . date("F", mktime(0, 0, 0, $month, 1, $year)) . ">"; // </January>}echo '</calendar>';mysql_close();?>[/code]Any ideas what is going on here?Thanks a lot for your time.Cheers.:) Quote Link to comment Share on other sites More sharing options...
flash gordon Posted December 3, 2006 Author Share Posted December 3, 2006 Sorry for posting...It is amazing what google and a translator will give you....[code=php:0]for ($i=1; $i<13; $i++) {$month = $i;$query = "SELECT * FROM $table WHERE month='" . $month . "' AND year ='" . $year . "'";$myQuery = mysql_query($query);echo mysql_error (); // <<-----ECHO OUT REAL ERROR[/code]Cheers Quote Link to comment Share on other sites More sharing options...
genericnumber1 Posted December 3, 2006 Share Posted December 3, 2006 EDIT: nevermind, good to hear you got it working 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.