CodeIgniter Table Helper question

Hi folks,

I am attempting to build tables derived from a mysql query in codeigniter and got everything working great, but have run into a bit of a roadblack.

What I am needing to do is build dynamic URLs based on the member ID of a member for a given row in the rendered table. Had I done this in conventional PHP, this would have been no problem because I could just use the member_id column from the returned data as part of the URL string, but in codeigniter, I am noticing that there is no mechenism for grabbing any of the query data as the rows are being built using the HTML Table helper.

Anyone else run into this and possibly arrive at a solution?

Thanks.

~A~
LVL 12
Richard DavisSenior Web DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris StanyonWebDevCommented:
Instead of just generating the table directly from the database, you can query your database, loop through the records and add the table rows manually. That way you'll get full control over each table fow.

Something like the following:


$this->load->library('table');

$query = $this->db->query("SELECT * FROM my_table");

foreach ($query->result() as $row)
{
	$this->table->add_row($row->memberID, $row->name, $row->address);   
}

echo $this->table->generate(); 

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Richard DavisSenior Web DeveloperAuthor Commented:
Perhaps I might have to hack the HTML Table class and see if there's a way to use values from in there.
Your suggestion coupled with one I saw on StackOverflow might have to be alternatives I will need to keep at the top of my considerations.

Thanks Chris.

~A~
0
Richard DavisSenior Web DeveloperAuthor Commented:
Although it was not what I was hoping for as an answer, it will suffice as an interim solution until I can find a core-based solution or write one myself.

Thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.