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?

Recommended Answers

All 6 Replies

Hi,

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

$smarty->assign('data_from_db',$this_query->result());

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.

commented: Nice example & tutorial! +9

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

Thanks Veedeoo.
I will try this & let you knw :)

try Updating each row, Deleting, And Creating

Hello, if i want to use ajax calls+ Jquery, then :s

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.