Paul Goepfert wrote:
I placed the echo statements in my code and I found out that my query
was empty. I also went a step further and tested if I was getting the
correct outputs from the queries that initially do at the beginning of
the method. Instead of getting an output like "March" I got an output
that says "Resource id#9". I don't get it. I tested the sql
statement in MySQL that I have on my computer. It worked, Why
wouldn't it give the same output through mysql_query()?
Ahh, didn't notice that.
$query1 = mysql_query("SELECT months FROM Month WHERE m_id =
month(curdate())");
$query2 = mysql_query("SELECT dayNum FROM Days WHERE dayNum =
day(curdate())");
$query3 = mysql_query("SELECT year FROM Year WHERE year = year(curdate())");
These return result resources (kinda like '$fp = fopen' doesn't return
the file - it returns a handle only), not the results. You need to do:
$query1_data = mysql_fetch_assoc($query1, 0, 0);
then
switch($query1_data) {
....
}
see http://www.php.net/mysql_query and
http://www.php.net/mysql_fetch_assoc for more info.
On 3/26/06, Chris <dmagick@xxxxxxxxx> wrote:
Paul Goepfert wrote:
Hi all,
I have wriiten a function that determines whether tomorrows date is
the first of the month or not then returns a SQL string based on
whether its the first of the month or not. According to my apache
error logs I get an error that says:
[Sun Mar 26 21:43:14 2006] [error] [client 192.168.0.2] PHP Warning:
mysql_fetch_array(): supplied argument is not a valid MySQL result
resource in C:\\Program Files\\Apache
Group\\Apache2\\htdocs\\validation.php on line 331
I understand that this is a warning but I believe that it has
something to do with the fact that no output is being displayed. All
other mysql database outputs work fine.
This is the code that sets the query in the mysql_query parameter
$Month_query = mysql_query($this->determineMonth());
Add this after your month_query call:
echo mysql_error() . "<br/>";
It will tell you what's wrong with the query. I'd probably also print
out the query:
$qry = $this->determineMonth();
echo $qry . "<br/>";
and run it manually (if something does get returned).
--
Postgresql & php tutorials
http://www.designmagick.com/
--
Postgresql & php tutorials
http://www.designmagick.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php