Hello i'm stil learning, using Codeigniter can someone tell me, or give example code?
what i need is in Round Id
we have 111
i want give it link and search database with value 111 how to do that? here the code i tried but still not right
<div class="row" id="ajaxdata">
<table border="1">
<tr>
<th>Round Id</th>
<th>Player Id</th>
<th>Bet Place</th>
<th>Total Bet</th>
<th>Win</th>
<th>Lose</th>
</tr>
<?php foreach ($tbl_bet_spot as $data) {?>
<tr>
<td><a href="<?php echo site_url('account/detail_round_id?select=111');?>"><?php echo $data->round_id;?></a>
<td><?php echo $data->id;?></td>
<td><?php echo $data->bet;?></td>
<td><?php echo $data->total_bet;?></td>
<td><?php echo $data->win;?></td>
<td><?php echo $data->lose;?></td>
</tr>
<?php } ?>
</table>
</table>
</div>
controller
public function detail_round_id(){
$select = $_GET['select'];
$data['tbl_bet_spot'] = $this->login_model->selectRoundId_by_round($select)->result();
print_r ($data);
}
i just try with my code and it work now, but it's static in here
<td><a href="<?php echo site_url('account/detail_round_id?select=111');?>"><?php echo $data->round_id;?></a>
how i can send this value <?php echo $data->round_id;?>
properly into controller? thanks a lot.
Use this code
<td><a href="<?php echo site_url()?>/account/detail_round_id/<?php echo $data->round_id;?>"><?php echo $data->round_id;?></a></td>
controller
public function detail_round_id(){
$select = $this->uri->segment(3);
$data['tbl_bet_spot'] = $this->login_model->selectRoundId_by_round($select)->result();
print_r ($data);
}
Try this may help you,
In view make link like this,
<td><a href="<?php echo site_url('account/detail_round_id/'.$data->round_id);?>"><?php echo $data->round_id;?></a>
And in controller add parameter like this,
public function detail_round_id($id){
$data['tbl_bet_spot'] = $this->login_model->selectRoundId_by_round($id)->result();
print_r ($data);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With