Skip to content
Snippets Groups Projects
Commit 520a791a authored by pbarroca's avatar pbarroca
Browse files

Fonctions: modif pour mode strict + refacto

parent 775b101d
Branches
Tags
No related merge requests found
......@@ -66,16 +66,24 @@ function fetchAll($req,$num=false)
// ---------------------------------------------------
function getWhereSql($conditions)
{
if(!$conditions) return "";
if(gettype($conditions)=="string") $conditions[0]=$conditions;
foreach($conditions as $condition)
{
if(!trim($condition)) continue;
if($where) $where.=" and ";
$where.=$condition;
$where = '';
if (!$conditions)
return $where;
if ('string' == gettype($conditions))
$conditions[0] = $conditions;
$clauses = array();
foreach ($conditions as $condition) {
$trimmed = trim($condition);
if (!$trimmed) continue;
$clauses[] = $trimmed;
}
if(!$where) return "";
$where=" where ".$where;
if (0 == count($clauses))
return $where;
$where = " where " . implode(' and ', $clauses);
return $where;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment