July 1, 201115 yr Hi All, I have some code am using php and sql to grab the data, but what i want to know is how do i do the following: When I link is clicked on on the left side of the page how do i get the content using a foreach method in php to display on the right side of the same page by using javascript or something similar? My php code is (which is the display box on the right <div id="content-right"> <h2>Events/Rideouts</h2> <div id="display"> <?php $query = $this->db->query("SELECT * FROM mcd_events "); foreach ($query->result() as $row) { $id = $row->id; ?> <p><?php echo $row->description ?></a></p> <?php } ?> </div> <div class="clear"></div> </div> then on the left in another div i have some links which are like this: <div id="content-left"> <div id="events" class="scroll-pane"> <?php $query = $this->db->query('SELECT * FROM mcd_events'); foreach ($query->result() as $row) { $row->id; ?> <h3>Date:<?php echo date("F j, Y",strtotime($row->created_on)) ?></h3> <p><br /><a href="events/<?php echo $row->id ?>" id="linkid"><?php echo $row->title ?></a></p> <?php } ?> </div> </div> Can anyone help me with this please, thanks for reading and will look froward to your replies....
Create an account or sign in to comment