Php 组合多个查询

Php 组合多个查询,php,mysql,Php,Mysql,我想这样做: set @col = 'test'; select @col; 并在mysql_查询PHP函数中使用。如何才能让它返回第二次查询的“测试”结果?mysql\u查询不支持多个查询。您需要使用这些函数来实现这一点。您可以将两个函数合并为一个函数 select if (@col is null, @col:='test', @col); select a,b,c,d from table1 where a=2 union all select a,b,c,d from table

我想这样做:

set @col = 'test'; select @col;

并在mysql_查询PHP函数中使用。如何才能让它返回第二次查询的“测试”结果?

mysql\u查询不支持多个查询。您需要使用这些函数来实现这一点。

您可以将两个函数合并为一个函数

select if (@col is null, @col:='test', @col);
select a,b,c,d from table1 where a=2

union all

select a,b,c,d from table1 where a=3;