I have a page that hits the database to display the records. One of the columns is 'startDate'. I format this for display like this:
<td valign="top"><?php echo date('m/d/Y',strtotime($row_GetAds['startDate'])); ?></td>
The page returns the following error:
[ERROR][8][Undefined index:
startDate][/home/.paco/campuscb/campuscorkboard.com/search_jobs.php:319][ERR
Whats the sql statement look like? if you have a function of some sort in the select
statement you'll have to give it a name:
select FUNC_NAME(column), column2 from table
- change to -
select FUNC_NAME(column) as column, column2 from table
If I comment out the error_reporting include file, the page renders fine. I
have checked the DB and the startDate column has a valid date in it.
Is the startDate the same as the current date? My bet is that strtotime() thinks your first paramater is an empty string, and then applying that conversion relative now().
Just to clarify this, strtotime has two ways that it behaves, if the first paramater looks
like a date (ie 2003-12-01), then it will return the unix timestamp for that. Other wise it
will treat the string as a modifier to the relative time of the second parameter (defaulting to time()).
http://php.net/strtotime
I hope that clarifies things.
Curt
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php