PHP DB 包装器 where 语句 [英] Php DB wrapper where statement

查看:27
本文介绍了PHP DB 包装器 where 语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 php Pdo 中得到了这个:

I got this in php Pdo:

$db = DBWrapper::getInstance();

$table = "table";
$columns   = array("id", "firstname", "lastname");
$whereRand = array('categorie_bit = :idRand');
$values    = array('idRand' => 00);
$orderBy   = array('RAND()');

$result_set  = $db->select($table,$columns,Null, Null, $orderBy, 1);

foreach($result_set as $result) {}

这行得通,但我试图在 select 中实现 where 语句我试过了,但没有奏效:

This works, but I am trying to achieve a where statement inside the select I tried this but it did not work:

$result_set  = $db->select($table,$columns,$whereRand, Null, $orderBy, 1);

有谁知道如何实现这一目标?

Does anyone know how to achieve this?

推荐答案

我解决了,是个小错误....

I solved it, was a pitty mistake....

改变了这个:

$result_set  = $db->select($table,$columns,Null, Null, $orderBy, 1);

为此:

$result_set  = $db->select($table, $columns, $whereRand, $valuesRand, $orderBy, 1);

我忘记添加价值了.

这篇关于PHP DB 包装器 where 语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆