problem with anchor tag

hi there
i'm newbie with CI and already have problem that I couldnt find any solution in the forum or user guide
I want to have a dynamic link that get the id of selected row from database because I want to open that row in a new pop up window using jquery but I face with same error with every changes I made in codes.I would be appreciated if any one could solve is my code

the controller

class Product extends Controller {
function pro() {
        $data['records'] = $this->product_model->pro($id);

The product_view file
<table align="center" style="vertical-align: middle; top: 120px;">
            &lt;?php  foreach($records as $rows) : ?&gt;
            <tr>&lt;?=anchor('product/pro/'.$rows->id,$rows->title) rel=number1;?&gt;
                <td>&lt;?php echo $rows->name; ?&gt;</td>
                <td>&lt;?php echo $rows->price; ?&gt;</td>
            &lt;?php endforeach; ?&gt;

The product_model
function Pro($id){
     $query = $this->db->get_where('product', array('id'=>$id));
      $ret['rows'] = $query->get()->result();
        return $ret;  

Try this:
&lt;?=anchor('product/pro/'.$rows->id,$rows->title, array('rel' => 'number1'));?&gt;

Your probably getting a php syntax error. The first two parameters of the anchor function are "href" and "title" respectively, title being the text between the tags. To add extra attributes(i.e. onclick, id, and in your case "rel", they need to be stored in an array in the third parameter of the anchor function.

Hope this helped.

dear shoe thanks for rapid answer I do the exact thing u say but now it echo something strange!!!
this is the out put of anchor tag :
id,$rows->name, array('rel' => 'example1'));?&gt;
before I make the changes that u mentioned me it always give this php error that unknown property::$id is defined ....
thanks again for your kindness. Smile

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.