List,
Without getting into the specific problem the general debug path I'd follow would be: -

1. Make sure you are actually connected to the database, you say it's the admin area? Does the admin area login with different details? try eching the result of a "select NOW()" right at the start of the admin area.

2. Make sure the SQL works, echo the $x just before it gets sent to the database and then past it into the MySQL command line.

3. Make sure all the variables used in the query (not relevant to you) and database connection ($db) are set and that you're using the right result set ($r) in this case.

From the error I'd say you've got either 1 or 2, can't be much more specific with the information I'm afraid. Are "begdate" and "enddate" ambiguous?

Regards,
   Phil
Hello,

I'm running f.a.m.p, f =freebsd 4.7 and mysql is 3.23.52.

Anyway, I inherited a website from someone else's server(I don't know what they we're running) but the admin section of the website generates this error iin the apache error log when trying to login( on the screen just takes you back to login saying invalid:

<snip>
[Tue Oct 17 19:10:08 2006] [error] PHP Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /usr/local/apache/website/incoming/_includes/_page-specialeventsnav.php on line 16 [Tue Oct 17 19:10:08 2006] [error] PHP Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /usr/local/apache/website/incoming/_includes/_page-specialeventsnav.php on line 17 [Tue Oct 17 19:10:08 2006] [error] PHP Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /usr/local/apache/website/incoming/_includes/_page-specialeventsnav.php on line 20
<end snip>


code in question:

<script language="javascript">
<!--
function focus(urlstring) { window.open(urlstring,"adFOCUS","width=700,height=580,scrollbars=yes,toolbar=no,location=no,resizable=no");
}
//-->
</script>

<div id="mainnav">
<table width="180" border="0" cellpadding="0" cellspacing="0">
<tr><td align='left'><img src='_elements/spacer-blank.gif' height='1' width='180' border='0'></td></tr> <tr><td align='center'><font class='section'><u>Special Events</u></font><br><br></td></tr>
<tr><td align="center">
<? $x = "SELECT page_contents.title,page_contents.id FROM page_contents,page_sections WHERE page_contents.pagename = page_sections.pagename AND page_contents.display != 'N' AND page_sections.publicurl = '/specialevents.php' AND begdate <= Now() AND enddate > Now() ORDER BY rand() LIMIT 6";
   $r = mysql_query($x,$db);
   while ($re = mysql_fetch_array($r)) {
print "<a class=\"sideoff\" href=\"javascript:focus('http://www.website.com/viewevents.php?rid=$re[id]')\">$re[title]</a><br><br>\n";
   }
   $rcount = mysql_num_rows($r);
   if (($rcount == 6)) {
print "<a class=\"sideoff\" href='http://www.website.com/specialevents.php'>continued...</a><br><br>\n";
   }
?>
</td>
</tr></table>
</div>


Any and all help is much appreciated, thanks.



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to