> I have done the following to my code hoping that the fix would work
>
> $query1 = mysql_query("SELECT months FROM Month WHERE m_id =
month(curdate())");
> //echo $query1 . "<br />";
>
> $query1_data = mysql_fetch_assoc($query1);
> echo $query1_data . "<br />"; returns Array
> (The word that is)
Use: print_r($query1_data) or var_dump($query1_data) to see everything
in the array. If you want to use echo, you'd have to echo each index of
the array one at a time with something like: echo $query1_data[0];
http://php.net/echo
http://php.net/print_r
http://php.net/var_dump
> switch ($query1_data)
> {
You can't switch on an entire array. Switch is used to check the value
of a variable (which could be an index of the array, but not the entire
array).
Something like this should work:
switch($query1_data[months])
{
}
http://php.net/switch
In your original posting you have lines like the following in your
switch statement:
> if($query2 == 31)
As someone mentioned, mysql_query returns a resource ID, you then have
to use mysql_fetch_assoc (or one of the other mysql_fetch_* functions)
to get an array that you can use as you are trying to do.
So after doing: $query2_data = mysql_fetch_assoc($query2);
You could do: if($query2_data[dayNum] == 31)
In your switch statement you are checking for the full name of the
month, but your query will be returning the month number. Since you
don't have a default case on your switch statement, $return is never
being set, so " $month = $this->determineMonth(); " is not setting
$month to anything, which is why you are getting error messages.
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html
Brady
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php