RE: [PHP-DB] What's wrong with this code?
| From: | Matt Williams | Date: | Fri, 16 Feb 2001 15:15:14 +0000 |
| Subject: | RE: [PHP-DB] What's wrong with this code? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-6689@lists.php.net to get a copy of this message | ||
> <?
> $link = mysql_connect ("localhost", "www", "scripts4") or die
> ("Could not
> connect");
> $db = mysql_select_db ("schileens_db") or die ("Could not select
> database");
> ?>
> <TITLE>Weekday events</TITLE>
> </HEAD>
> <BODY>
> <?
> # make function #
> function display_events ()
> {
> # declare global variable coming from other page #
> global $PHP_SELF;
> # select events for this day #
> $query="select msg_year, msg_month, msg_day, msg_title from
> calendar_messages where CONCAT(msg_year,msg_month,msg_day) = $yyyymmdd" ;
> $result=mysql_query ($query) or die ("cannot execute query");
>
> while ($row = mysql_fetch_array ($result))
> {
> printf ("%s %s %s %s<BR>\n", $row["msg_year"],
> $row["msg_month"],
> $row["msg_day"], $row["msg_title"]);
> }
> mysql_free_result ($result); } ;
> ?><A href="drop5.php">back to weekday selection
> </A>
>
where is the variable $yyyymmdd coming from?? This should be global if you
want to use it in the function
Also why have the columns for the date when you could use DATE??
Regards
M@