Page 1 of 1

string replacing an array

Posted: Sun Oct 22, 2006 9:06 pm
by GeXus
I'm using a multidimensional array for looping through a result set.

Code: Select all

while ($row = $db->fetch_array())
{
	
	$result[] = $row;
	
}
I need to apply some formating to specific columns... how would I do this?

For example, I am able to do the following

Code: Select all

$result[1][start_dt] = $result[1][start_dt] . ' added text';
This works, however with error reporting on, it says "Use of undefined constant start_dt - assumed 'start_dt' "

So i'm assuming this is not the correct way to do this....
[/quote]

Posted: Sun Oct 22, 2006 9:22 pm
by Cameri
you need to enclose start_dt within quotes:

Code: Select all

$result[1]['start_dt'] = $result[1]['start_dt'] . ' added text';

Posted: Sun Oct 22, 2006 9:39 pm
by GeXus
Ah.. ha, thanks a lot!