简体   繁体   中英

CodeIgniter, Get URL Result

I have php code in my VIEW like this :

<tbody>
<?php $i=1; foreach ($kelas_kuliah as $val): ?>
<tr>
    <td>
        <?php site_url('/admin/cdtkelas_kuliah/get_id_sms/'.$val->kdpsttrak);?>
    </td>
</tr>
<?php $i++; endforeach; ?>

it should return value like this :

7678c279-0656-4458-968e-9a1c5a8b0fdb

this is my CONTROLLER :

    public function get_id_sms($prmkode_prodi){
    $client = new SoapClient($this->wsdl);

    $username = '******';
    $password = '******';

    $token = $client->GetToken($username, $password);

    $prmtable  = 'sms';
    $prmfilter = "kode_prodi like '".$prmkode_prodi."'";

    $get_record = $client->GetRecord($token,$prmtable,$prmfilter);

    echo $get_record->result->id_sms;
}

but when I ran it, it shows nothing, why is that ? thanks.

It shows nothing because you missed echo . See the updated code

<td>
   <?php echo site_url('/admin/cdtkelas_kuliah/get_id_sms/'.$val->kdpsttrak);?>
         ^^^^^
</td>

Edited: Try this if you want values only

<td>
   <?php echo $val->kdpsttrak;?>
</td>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM