0

I want to fetch data from 2 table.

Here is my code

$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);
}

This code give me error like this

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM user_posts AS A JOIN user_metapost AS M ON (M.user_postid = A' at line 3

Kevin Patel
  • 101
  • 1
  • 10

0 Answers0