Re: Am I missing Something
| From: | Phillip S. Baker | Date: | Fri, 30 Jan 2004 21:34:40 +0000 |
| Subject: | Re: Am I missing Something | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-176404@lists.php.net to get a copy of this message | ||
At 09:54 AM 1/30/2004 +0000, Stuart wrote:
Phillip S. Baker wrote:$sql = "SELECT CONCAT(DATE_FORMAT(initiation_date, '%b '), initiation_day, ',' , DATE_FORMAT(initiation_date, ' %Y')) AS weekend, DATE_FORMAT(initiation_date, '%c ') AS month, initiation_day FROM center, initiation WHERE initiation_date >= CURRENT_DATE AND initiation_center = center_id AND center_id = $g_cen ORDER BY initiation_date ASC"; $wkends = new MySQL($sql);I am running version 4.3.4 of PHP. Fairly recently. I am trying to call a pretty basic programming tool. Maybe I am just really tired, or something but I am not getting what is going on. Is there something I am missing. I am pulling a SQL call on a date to get the month. I am using Date_format and the %c to get the Month in numeric format. The I plug it into a variable and my intention is to call it as the index of an array. Nothing prints. When I turn on all notices I get a notice that it is an undefined index. What the heck is going on??Sorry, left my mind reading helmet at home today. How about sharing some code.
while ( $rec = $wkends -> fetchRow () ) {
list($sday, $eday) = explode('_', $rec['initiation_day']);
if ( $sday == '29' || $sday == '30' || $sday == '31' ) {
$somevalue = $rec[1];
echo $g_dates .= $somarray[$somevalue];
}
}
Through testing, if I echo out $rec[1] I get to correct value (3)
If I echo out $somevalue I get the correct value (3)
However $somarray[$somevalue] prints out nothing.
Again if I display all notices then what I get is that there is an undefined index on the lines that has
echo $g_dates .= $somarray[$somevalue];
And $somarray[ has more than four values.
Blessings
Phillip