if [ $COMMAND_LINE_INSTALL ]; then
# Do stuff for CLI land
else
# Do stuff for GUI land
fi
function check($string, $id, $type){
if($type == "edit"){
$sql = "SELECT * FROM test where first = '".$string."' and id = ".$id."";
$query = $this->db->query($sql);
$array = $query->result();
if(!empty($array)){
return true; #VALID
}else{
$this->check($string,NULL,"add");
}
}else{
$sql = "SELECT * FROM test where name = '".$string."'";
$query = $this->db->query($sql);
$array = $query->result();
if(empty($array)){
return true;
}else{
return false;
}
}
}
不会返回该值。我用boolean或string值尝试了这个。请帮忙。
答案 0 :(得分:4)
function check($string, $id, $type){
if($type == "edit"){
$sql = "SELECT * FROM test where first = '".$string."' and id = ".$id."";
$query = $this->db->query($sql);
$array = $query->result();
if(!empty($array)){
return true; #VALID
}else{
return $this->check($string,NULL,"add");
}
}else{
$sql = "SELECT * FROM test where name = '".$string."'";
$query = $this->db->query($sql);
$array = $query->result();
if(empty($array)){
return true;
}else{
return false;
}
}
}
缺少退货声明。你应该将回报添加到该行。