0
有人可以请指导我如何获取“pk”的mysql行值到$ response变量,以便脚本能够自动取消关注用户。我已经尝试过这个脚本,并且在提供pk id时它会取消关注,但我想从mysql自动获取它以便能够运行它。感谢您提供的任何帮助。Codeigniter获取MySQL值
这些都是我没有成功尝试过的方法:
$this->db->select('pk');
$this->model->from(INSTAGRAM_FOLLOW_TB);
$this->db->where("id = '11'");
$query1 = $this->db->get();
$result = $query1->result();
主ID,只有取消关注由Mushfik媒体创造了这个ID-,
$response = $i->unfollow($result);
我也曾尝试
$accounts = $this->model->fetch("*", INSTAGRAM_ACCOUNT_TB, "id = '11'");
$response = $i->unfollow($accounts->pk);
但没有奏效。 $ NEED MYSQL数据值是其中值是应该呼应,但并不
case 'unfollow':
try {
$result = $i->getSelfUsersFollowing();
if(!empty($result) && $result->status == "ok" && !empty($result->users)){
$response = $i->unfollow($NEED MYSQL DATA VALUE);
$response = $response->status;
$CI =& get_instance();
$CI->load->model('Schedule_model', 'schedule_model');
$lang = $CI->db->insert(INSTAGRAM_FOLLOW_TB, array(
"pk" => $row->pk,
"name" => $row->username,
"type" => $data->schedule_type,
"uid" => $data->uid,
"account_id" => $data->account,
"account_name" => $data->name,
"created" => NOW
));
}
} catch (Exception $e){
$response = $e->getMessage();
}
break;
谢谢,但实际上并没有带来pk值 – user3498121
因为这是事实,所以需要更多的信息。您可以查看实际的SQL查询以满足您的需求: $ this-> db-> last_query(); 我的查询有一个固定的ID为11,你可能需要改变。 –
这是在error_log上显示的错误:[13-Aug-2017 22:54:07 Europe/London] PHP致命错误:使用$ this而不是在/home/testt/public_html/instagram_helper.php中的对象上下文中811 – user3498121