Hello guys,
Am new to php with Ci... am trying to display a gridview in a form so as to extract data frm db & display the value.. .Any help?

4 Years
Discussion Span
Last Post by shakayu


Like any other responses I've posted for all framework based questions..e.g. cake, CI, Zend, symfony, and others.. All of these frameworks shares a pretty similar coding convention. So, for the Code Igniter, the syntax will be as simple as this

General syntax for the CI database library

$your_query = "SELECT * FROM everywhere WHERE something = '$something'";
## use the CI query method
$this_query = $this->db->query($your_query);

Now, you decide what are you going to do with the query result.. example one

## put them in some row variable and echo them
foreach ($this_query->result() as $row)
   echo $row->col1;
   echo $row->col2;
   echo $row->col3;

example two, Send the result to the template engine e.g. smarty, twig, dwoo, tinybutstrong. It does not matter, they are all the same in nature.

## this query result is a CI built in method included in the library and it will return an array  if not false
## using the same query above send the result to the template engine


If you are new to CI and PHP, I strongly suggest for you to learn the ins and outs of the OOP . Otherwise, I don't see any reason to rush in using a framework at this level. It is not that hard, it just requires patience. I mean lots and lots of them...

Update! Here is a nice tutorial on building grids with jquery. The concept is the same as I have already mentioned above, with the exception of extending the pre-existing classess.

Edited by veedeoo: info added

Votes + Comments
Nice example & tutorial!

I have to display the values from that particular table..so wat you suggest me to do ?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.