hi i have problem with my library i want to select data from database then i want to insert again with that selected data
here my code
class Sms {
function __construct() {
$ci = &get_instance();
}
function send($no,$msg,$username)
{
$ci = &get_instance();
$ci->load->model('log_model');
$host = "127.0.0.1";
$port = "8800";
$username = "admin";
$password = "";
$hp = $this->db->query('SELECT hp FROM t_akun');
$fp = fsockopen($host, $port, $errno, $errstr);
if (!$fp) {
"errno: $errno \n";
echo "errstr: $errstr\n";
return $result;
}
fwrite($fp, "GET /?Phone=".$no."&Text=" . rawurlencode($msg) . " HTTP/1.0\n");
if ($username != "") {
$auth = $username . ":" . $password;
$auth = base64_encode($auth);
fwrite($fp, "Authorization: Basic " . $auth . "\n");
}
fwrite($fp, "\n");
$res = "";
while(!feof($fp)) {
$res .= fread($fp,1);
}
fclose($fp);
$nolog = explode(',',$no);
date_default_timezone_set('Asia/Jakarta');
$now = date("Y-m-d H:i:s");
foreach($nolog as $row)
{
$data= array(
'username'=>$username,
'hp'=>$hp,
'act'=>'Send',
'd_log'=>$now
);
$ci->log_model->add_log($data);
}
if($res)
{
return $no;
}
}
}
thats code was error
but if $hp change into code like this it works
$ci = &get_instance();
$ci->load->model('log_model');
$host = "127.0.0.1";
$port = "8800";
$username = "admin";
$password = "";
$hp = "12345678";
pls help me :(