如何使用ssp类从2表中获取数据?

时间:2016-04-01 04:37:52

标签: mysql ssp

我想从2个表中获取数据。

这是我的代码

$columns = array(
    array('db' => 'A.id', 'dt' => 0),
    array('db' => 'A.id', 'dt' => 1),
    array('db' => 'A.id', 'dt' => 2),
    array('db' => 'M.value', 'dt' => 3),
    array('db' => 'A.entrydate', 'dt' => 4),
    array('db' => 'A.name', 'dt' => 5),
    array('db' => 'A.slug', 'dt' => 6),
    array('db' => 'A.description', 'dt' => 7),
);
$_POST['otherquery'] = " type='testimonial' ";
$rows = $user_posts->testimionalgridfill($_POST, $columns);
var_dump($rows);
exit();

public function testimionalgridfill($GetData, $columns) {

    $joinquery = "FROM `user_posts` AS `A` JOIN `user_metapost` AS `M` ON (`M`.`user_postid` = `A`.`id`)";
    return SSP::simple($GetData, 'user_posts AS A', 'A.id', $columns, $joinquery);
}

这段代码给我这样的错误

  

您的SQL语法有错误;查看与您的MySQL服务器版本对应的手册,以便在“FROM user_posts AS A加入user_metapost AS M ON M附近使用正确的语法。第3行user_postid = A'

0 个答案:

没有答案