哪位大虾帮忙看下这个PHP查询的类??先谢过了!
下面是一个SQL查询的类,里面的参数用法我不是很清楚,麻烦帮忙详细注释一下:
//简化查询select
public function select($table, $columnName = "*", $condition = '', $debug = '') {
$condition = $condition ? ' Where ' . $condition : NULL;
if ($debug) {
echo "SELECT $columnName FROM $table $condition";
} else {
$this->query("SELECT $columnName FROM $table $condition");
}
}
//简化查询select
public function select($table, $columnName = "*", $condition = '', $debug = '') {
$condition = $condition ? ' Where ' . $condition : NULL;
if ($debug) {
echo "SELECT $columnName FROM $table $condition";
} else {
$this->query("SELECT $columnName FROM $table $condition");
}
}
作者: 紫竹洞箫 发布时间: 2011-08-09
我来帮你顶
作者: phpsss626 发布时间: 2011-08-10
<?php
public function select($table, $columnName = "*", $condition = '', $debug = '') {
$condition = $condition ? ' Where ' . $condition : NULL; //判断查询条件是否为空如不为空条件前面加上where再接上条件子句。
if ($debug) { //是否开启调试模式
echo "SELECT $columnName FROM $table $condition"; //如果调试模式$debug为真打印出SQL查询语名
} else {
$this->query("SELECT $columnName FROM $table $condition"); //如果调试模式$debug为假直接执行query内部方法
}
?>
public function select($table, $columnName = "*", $condition = '', $debug = '') {
$condition = $condition ? ' Where ' . $condition : NULL; //判断查询条件是否为空如不为空条件前面加上where再接上条件子句。
if ($debug) { //是否开启调试模式
echo "SELECT $columnName FROM $table $condition"; //如果调试模式$debug为真打印出SQL查询语名
} else {
$this->query("SELECT $columnName FROM $table $condition"); //如果调试模式$debug为假直接执行query内部方法
}
?>
作者: jerking 发布时间: 2011-08-10