$res = DB::connection("mysql_business")->table("t_activity")
->select("SELECT app_id,title ,created_at,id
FROM t_activity
WHERE created_at > ? ORDER BY created_at DESC", [ "2018-04-01 20:11:12"]);
var_dump($res);//print some database.php information
print many strings like this
object (IlluminateDatabaseQueryBuilder)-sharp68 (22) {
["connection"] = >
object (IlluminateDatabaseMySqlConnection)-sharp58 (16) {
["pdo":protected]=>
object(Closure)-sharp57 (2) {
["static"]=>
array(1) {
["config"]=>
array(12) {
["driver"]=>
string(5) "mysql"
["port"]=>
string(4) ""************************""
["database"]=>
string(14) "************************"
["username"]=>
string(4) "root"
["password"]=>
string(12) ""************************""
["charset"]=>
string(4) "utf8"
["collation"]=>
string(15) ""************************""
["prefix"]=>
string(0) ""
["strict"]=>
bool(false)
["engine"]=>
NULL
["name"]=>
string(14) ""************************""
["host"]=>
string(33) ""************************""
}
it just print information in database.php, not the answer I want, why??
and below code is it right
$ret = DB::connection("mysql_business")->table("t_activity")->where("created_at", ">", "2018-04-01 20:11:12")
->select("app_id", "title", "created_at", "id")->get();