Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/258.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/65.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何修改此PHP查询以添加数据库值';时间戳';?_Php_Mysql_Sql - Fatal编程技术网

如何修改此PHP查询以添加数据库值';时间戳';?

如何修改此PHP查询以添加数据库值';时间戳';?,php,mysql,sql,Php,Mysql,Sql,我正在使用另一个Stackoverflow用户帮助我的以下查询,这对我来说是全新的: "SELECT CONCAT(u1.firstname,' ',u1.lastname) as sender,CONCAT(u2.firstname,' ',u2.lastname) as receiver, t.points as points FROM transactions t INNER JOIN users u1 ON u1.id=t.sender_id INNER JOIN users u2

我正在使用另一个Stackoverflow用户帮助我的以下查询,这对我来说是全新的:

"SELECT CONCAT(u1.firstname,' ',u1.lastname) as sender,CONCAT(u2.firstname,' 
',u2.lastname) as receiver, t.points as points FROM transactions t INNER JOIN users u1 ON 
u1.id=t.sender_id INNER JOIN users u2 ON u2.id=t.receiver_id ORDER BY date DESC limit 5"
它工作正常,但我意识到我没有从数据库中获得值
'timestamp'
。如何向查询添加
时间戳
,以便在结果中回显它

“时间戳”
存储在
事务表中

谢谢。

使用

"SELECT CONCAT(u1.firstname,' ',u1.lastname) as sender,CONCAT(u2.firstname,' ',u2.lastname) as receiver, t.points as points, t.timestamp as timestamp FROM transactions t INNER JOIN users u1 ON u1.id=t.sender_id INNER JOIN users u2 ON u2.id=t.receiver_id ORDER BY date DESC limit 5"
使用

使用

使用


您只需在查询中添加
t.timestamp

"SELECT CONCAT(u1.firstname,' ',u1.lastname) as sender,CONCAT(u2.firstname,' 
',u2.lastname) as receiver, t.points as points, t.timestamp FROM transactions t INNER JOIN users u1 ON 
u1.id=t.sender_id INNER JOIN users u2 ON u2.id=t.receiver_id ORDER BY date DESC limit 5"

您只需在查询中添加
t.timestamp

"SELECT CONCAT(u1.firstname,' ',u1.lastname) as sender,CONCAT(u2.firstname,' 
',u2.lastname) as receiver, t.points as points, t.timestamp FROM transactions t INNER JOIN users u1 ON 
u1.id=t.sender_id INNER JOIN users u2 ON u2.id=t.receiver_id ORDER BY date DESC limit 5"

您只需在查询中添加
t.timestamp

"SELECT CONCAT(u1.firstname,' ',u1.lastname) as sender,CONCAT(u2.firstname,' 
',u2.lastname) as receiver, t.points as points, t.timestamp FROM transactions t INNER JOIN users u1 ON 
u1.id=t.sender_id INNER JOIN users u2 ON u2.id=t.receiver_id ORDER BY date DESC limit 5"

您只需在查询中添加
t.timestamp

"SELECT CONCAT(u1.firstname,' ',u1.lastname) as sender,CONCAT(u2.firstname,' 
',u2.lastname) as receiver, t.points as points, t.timestamp FROM transactions t INNER JOIN users u1 ON 
u1.id=t.sender_id INNER JOIN users u2 ON u2.id=t.receiver_id ORDER BY date DESC limit 5"

哪个表有
时间戳
列?事务是表。哪个表有
时间戳
列?事务是表。哪个表有
时间戳
列?事务是表。哪个表有
时间戳
列?事务是表。我可以发誓我已经试过了,几种不同的方式。。。谢谢你,救命恩人。我发誓我已经试过了,几种不同的方法。。。谢谢你,救命恩人。我发誓我已经试过了,几种不同的方法。。。谢谢你,救命恩人。我发誓我已经试过了,几种不同的方法。。。谢谢你,救命恩人。