上面的问题^^^^^没有正确答案
由于该问题中接受的答案导致 MYSQL 页面将查询分开,因此我仍然需要 PHP 中的解决方案,并且此问题中提供的答案中的链接实际上是我需要的。
我正在尝试用where
SQL 中的子句创建一个有用的数组
好吧,让我们假设这些:
where a=b and b=c or d=g and (a=f or x=6)
where a=b and b='d and f' or d=g and (a=f or x=6)
where a=b and b="d and f (or just text)" or d=g and (a=f or x=6)
where "a"=b and
b="Note that colum names might be quoted differently in different databases" or d=g and (a=f or x=6)
where "a"='b' and
b="as well as values" or d=g and (a=f or x=6)
where "a"='b' and
b="multiple levels" or d=g and (a=f or x=6 or (x=5 and v=7))
我想尝试将任何 where 子句(使用 key=value ... 也就是没有子查询)分解成有用的数组?就像是 :
x= array(
array('a' => 'b' , 'b' => 'c'),
array('d' => 'g' , array(array('a' => 'f'),array('x' => '6')),
);
其中 AND 在一个数组中或在新数组中
或任何其他格式,只是为了能够将整个查询重建为我想要的任何内容。
preg_match 足够了吗?