[eluser]jedd[/eluser]
Quote:So, it can be done with arrays but I've had no luck with replacing data in objects ($result->result()).
I'm old school - I use arrays everywhere. There's not many compelling reasons to use objects in this context, especially for return values that are consistently array-like. The fact that a lot of PHP functions work better (or at the least more predictably for slow people like myself) for arrays is reason enough for me.
I'd also point out that the CI table class is eschewed by many people around here (including, quite recently, me) - primarily because it breaks the presentation separation that you expect with controllers .v. views. Plus it's pretty sucky, and not just because people use tables where they should use something else (divs, say) but because you're going to get much better results, for very little effort, by creating your own view snippet that you send tabulatable data to instead.
Certainly worth considering trying to dump the table class, anyway. In this case it'd make it (even) easier to manage your column headers, using either an array you define in your config, or perhaps in your MY_Controller extension, that lets you alias your headings. Eg.
Code:
$table_headings = array (
"staff_id" => "Staff ID",
"name" => "Name",
"email_address" => "Email Address",
);
And in your view, just have your headings call something like:
Code:
$table_headings['staff_id']
Note that doing this also keeps separation between your model and your presentation - because at the moment if you want to change a presented column heading in your HTML page, you have to modify your SELECT statement. Tsk tsk (would be the appropriate response to this situation).
Quote:I know that spaces should not be used in column names but is the general opinion that spaces should not be used in column aliases as well?
That's my opinion, at least. Dunno about the General's.
Quote:If anyone has any ideas how to change the values of data in a controller when using the $data->result() then please post it. Someone is bound to have run into this before.
To be honest I'm now confused which problem we're looking at

Does any of the above negate this problem, or at least get you in the right direction?