本文整理汇总了PHP中search::get_query方法的典型用法代码示例。如果您正苦于以下问题:PHP search::get_query方法的具体用法?PHP search::get_query怎么用?PHP search::get_query使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类search
的用法示例。
在下文中一共展示了search::get_query方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: substr
function get_list_emps($id_corp)
{
if (isset($_POST['submit_emps_search'])) {
//Obtener datos del formulario de b�squeda
$this->get_fields_from_search_post();
//Generar consulta
if ($this->search_query[0] == '\\') {
//Guardar consulta para no modificar la variable
//que se mande denuevo al formulario
$query = $this->search_query;
//Se va creando la nueva query que se mandar� mas tarde
//al formulario (se busca la siquiente ocurrencia de comillas)
$query = substr($this->search_query, 2);
switch ($this->search_query[1]) {
case '"':
$cadena = substr($this->search_query, 2, stripos($query, '"'));
//Preparar la cadena para volver a mostrarla sin caracteres de PHP
$this->search_query = stripslashes($cadena);
break;
case '\'':
$cadena = substr($this->search_query, 2, stripos($query, '\''));
//Preparar la cadena para volver a mostrarla sin caracteres de PHP
$this->search_query = stripslashes($cadena);
break;
default:
break;
}
}
//Crear query
$my_search = new search();
$query = $my_search->get_query($this->search_query, FALSE, $this->search, $this->fields_list);
}
//Buscar los empleados de la empresa en la que se est� y coincidencia en id con los id de emps en drivers
$ADODB_FETCH_MODE = ADODB_FETCH_BOTH;
//crea una nueva conexin con una bbdd (mysql)
$this->db = NewADOConnection($this->db_type);
//le dice que no salgan los errores de conexin de la ddbb por pantalla
$this->db->debug = false;
//realiza una conexin permanente con la bbdd
$this->db->Connect($this->db_ip, $this->db_user, $this->db_passwd, $this->db_name);
//mete la consulta
if ($query != "") {
$this->sql = "SELECT * FROM " . $this->table_prefix . $this->table_name . " WHERE (" . $query . ") AND id_corp = " . $id_corp;
} else {
$this->sql = "SELECT * FROM " . $this->table_prefix . $this->table_name . " WHERE id_corp = " . $id_corp;
}
//la ejecuta y guarda los resultados
$this->result = $this->db->Execute($this->sql);
//si falla
if ($this->result === false) {
$this->error = 1;
$this->db->close();
return 0;
}
$this->num = 0;
while (!$this->result->EOF) {
//cogemos los datos del empleado
$this->emps_list[$this->num][$this->ddbb_id_emp] = $this->result->fields[$this->ddbb_id_emp];
$this->emps_list[$this->num][$this->ddbb_id_corp] = $this->result->fields[$this->ddbb_id_corp];
$this->emps_list[$this->num][$this->ddbb_id_user] = $this->result->fields[$this->ddbb_id_user];
$this->emps_list[$this->num][$this->ddbb_name] = $this->result->fields[$this->ddbb_name];
$this->emps_list[$this->num][$this->ddbb_last_name] = $this->result->fields[$this->ddbb_last_name];
$this->emps_list[$this->num][$this->ddbb_last_name2] = $this->result->fields[$this->ddbb_last_name2];
$this->emps_list[$this->num][$this->ddbb_birthday] = $this->result->fields[$this->ddbb_birthday];
$this->emps_list[$this->num][$this->ddbb_license] = $this->result->fields[$this->ddbb_license];
$this->emps_list[$this->num][$this->ddbb_phone] = $this->result->fields[$this->ddbb_phone];
$this->emps_list[$this->num][$this->ddbb_mobile_phone] = $this->result->fields[$this->ddbb_mobile_phone];
$this->emps_list[$this->num][$this->ddbb_fax] = $this->result->fields[$this->ddbb_fax];
$this->emps_list[$this->num][$this->ddbb_mail] = $this->result->fields[$this->ddbb_mail];
$this->emps_list[$this->num][$this->ddbb_address] = $this->result->fields[$this->ddbb_address];
$this->emps_list[$this->num][$this->ddbb_city] = $this->result->fields[$this->ddbb_city];
$this->emps_list[$this->num][$this->ddbb_state] = $this->result->fields[$this->ddbb_state];
$this->emps_list[$this->num][$this->ddbb_postal_code] = $this->result->fields[$this->ddbb_postal_code];
$this->emps_list[$this->num][$this->ddbb_country] = $this->result->fields[$this->ddbb_country];
//nos movemos hasta el siguiente registro de resultado de la consulta
$this->result->MoveNext();
$this->num++;
}
$this->db->close();
return $this->num;
}
示例2: substr
function get_list_users()
{
if (isset($_POST['submit_users_search'])) {
//Obtener datos del formulario de b�squeda
$this->get_fields_from_search_post();
//Generar consulta
if ($this->search_query[0] == '\\') {
//Guardar consulta para no modificar la variable
//que se mande denuevo al formulario
$query = $this->search_query;
//Se va creando la nueva query que se mandar� mas tarde
//al formulario (se busca la siquiente ocurrencia de comillas)
$query = substr($this->search_query, 2);
switch ($this->search_query[1]) {
case '"':
$cadena = substr($this->search_query, 2, stripos($query, '"'));
//Preparar la cadena para volver a mostrarla sin caracteres de PHP
$this->search_query = stripslashes($cadena);
break;
case '\'':
$cadena = substr($this->search_query, 2, stripos($query, '\''));
//Preparar la cadena para volver a mostrarla sin caracteres de PHP
$this->search_query = stripslashes($cadena);
break;
default:
break;
}
}
//Crear query
$my_search = new search();
$query = $my_search->get_query($this->search_query, FALSE, $this->search, $this->fields_list);
}
//Buscar los empleados de la empresa en la que se est� y coincidencia en id con los id de emps en drivers
$ADODB_FETCH_MODE = ADODB_FETCH_BOTH;
//crea una nueva conexin con una bbdd (mysql)
$this->db = NewADOConnection($this->db_type);
//le dice que no salgan los errores de conexin de la ddbb por pantalla
$this->db->debug = false;
//realiza una conexin permanente con la bbdd
$this->db->Connect($this->db_ip, $this->db_user, $this->db_passwd, $this->db_name);
//mete la consulta
if ($query != "") {
$this->sql = "SELECT * FROM " . $this->table_prefix . $this->table_name . " WHERE " . $query;
} else {
$this->sql = "SELECT * FROM " . $this->table_prefix . $this->table_name;
}
//la ejecuta y guarda los resultados
$this->result = $this->db->Execute($this->sql);
//si falla
if ($this->result === false) {
$this->error = 1;
$this->db->close();
return 0;
}
//cogemos los datos del usuario
if (!$_SESSION['super'] && !$_SESSION['admin']) {
$this->num = 0;
while (!$this->result->EOF) {
$users[$this->num][$this->ddbb_id_user] = $this->result->fields[$this->ddbb_id_user];
$users[$this->num][$this->ddbb_login] = $this->result->fields[$this->ddbb_login];
$users[$this->num][$this->ddbb_passwd] = $this->result->fields[$this->ddbb_passwd];
$users[$this->num][$this->ddbb_name] = $this->result->fields[$this->ddbb_name];
$users[$this->num][$this->ddbb_last_name] = $this->result->fields[$this->ddbb_last_name];
$users[$this->num][$this->ddbb_last_name2] = $this->result->fields[$this->ddbb_last_name2];
$users[$this->num][$this->ddbb_full_name] = $this->result->fields[$this->ddbb_full_name];
$users[$this->num][$this->ddbb_internal] = $this->result->fields[$this->ddbb_internal];
$users[$this->num][$this->ddbb_active] = $this->result->fields[$this->ddbb_active];
//nos movemos hasta el siguiente registro de resultado de la consulta
$this->result->MoveNext();
$this->num++;
}
$this->registrados = $this->num;
$num_usuarios = $this->num;
$k = 0;
for ($i = 0; $i < $num_usuarios; $i++) {
$num_groups = $this->get_groups($users[$i][$this->ddbb_id_user]);
$per = true;
for ($j = 0; $j < $num_groups; $j++) {
if ($this->groups_list[$j]['id_group'] == 2) {
$per = false;
} else {
if ($this->groups_list[$j]['id_group'] == 1) {
$per = false;
}
}
}
if ($per) {
$this->users_list[$k][$this->ddbb_id_user] = $users[$i][$this->ddbb_id_user];
$this->users_list[$k][$this->ddbb_login] = $users[$i][$this->ddbb_login];
$this->users_list[$k][$this->ddbb_passwd] = $users[$i][$this->ddbb_passwd];
$this->users_list[$k][$this->ddbb_name] = $users[$i][$this->ddbb_name];
$this->users_list[$k][$this->ddbb_last_name] = $users[$i][$this->ddbb_last_name];
$this->users_list[$k][$this->ddbb_last_name2] = $users[$i][$this->ddbb_last_name2];
$this->users_list[$k][$this->ddbb_full_name] = $users[$i][$this->ddbb_full_name];
$this->users_list[$k][$this->ddbb_internal] = $users[$i][$this->ddbb_internal];
$this->users_list[$k][$this->ddbb_active] = $users[$i][$this->ddbb_active];
//nos movemos hasta el siguiente registro de resultado de la consulta
$k++;
}
}
//.........这里部分代码省略.........
示例3: search
function get_list_contacts($id_client)
{
if (isset($_POST['submit_contacts_search'])) {
//Obtener datos del formulario de búsqueda
$this->get_fields_from_search_post();
//Crear query
$my_search = new search();
$query = $my_search->get_query($this->search_query, FALSE, $this->search, $this->fields_list);
}
//Buscar los contactleados de la contactresa en la que se está y coincidencia en id con los id de contacts en drivers
$ADODB_FETCH_MODE = ADODB_FETCH_BOTH;
//crea una nueva conexin con una bbdd (mysql)
$this->db = NewADOConnection($this->db_type);
//le dice que no salgan los errores de conexin de la ddbb por pantalla
$this->db->debug = false;
//realiza una conexin permanente con la bbdd
$this->db->Connect($this->db_ip, $this->db_user, $this->db_passwd, $this->db_name);
//mete la consulta
if ($query != "") {
$this->sql = "SELECT * FROM " . $this->table_prefix . $this->table_name . " WHERE (" . $query . ") AND id_client = " . $id_client;
} else {
$this->sql = "SELECT * FROM " . $this->table_prefix . $this->table_name . " WHERE id_client = " . $id_client;
}
//la ejecuta y guarda los resultados
$this->result = $this->db->Execute($this->sql);
//si falla
if ($this->result === false) {
$this->error = 1;
$this->db->close();
return 0;
}
$this->num = 0;
while (!$this->result->EOF) {
//cogemos los datos del contactleado
$this->contacts_list[$this->num][$this->ddbb_id_contact] = $this->result->fields[$this->ddbb_id_contact];
$this->contacts_list[$this->num][$this->ddbb_id_client] = $this->result->fields[$this->ddbb_id_client];
$this->contacts_list[$this->num][$this->ddbb_name] = $this->result->fields[$this->ddbb_name];
$this->contacts_list[$this->num][$this->ddbb_last_name] = $this->result->fields[$this->ddbb_last_name];
$this->contacts_list[$this->num][$this->ddbb_last_name2] = $this->result->fields[$this->ddbb_last_name2];
$this->contacts_list[$this->num][$this->ddbb_birthday] = $this->result->fields[$this->ddbb_birthday];
$this->contacts_list[$this->num][$this->ddbb_phone] = $this->result->fields[$this->ddbb_phone];
$this->contacts_list[$this->num][$this->ddbb_mobile_phone] = $this->result->fields[$this->ddbb_mobile_phone];
$this->contacts_list[$this->num][$this->ddbb_fax] = $this->result->fields[$this->ddbb_fax];
$this->contacts_list[$this->num][$this->ddbb_mail] = $this->result->fields[$this->ddbb_mail];
$this->contacts_list[$this->num][$this->ddbb_address] = $this->result->fields[$this->ddbb_address];
$this->contacts_list[$this->num][$this->ddbb_city] = $this->result->fields[$this->ddbb_city];
$this->contacts_list[$this->num][$this->ddbb_state] = $this->result->fields[$this->ddbb_state];
$this->contacts_list[$this->num][$this->ddbb_postal_code] = $this->result->fields[$this->ddbb_postal_code];
$this->contacts_list[$this->num][$this->ddbb_country] = $this->result->fields[$this->ddbb_country];
//nos movemos hasta el siguiente registro de resultado de la consulta
$this->result->MoveNext();
$this->num++;
}
$this->db->close();
return $this->num;
}
示例4: substr
function get_list_laborers()
{
if (isset($_POST['submit_laborers_search'])) {
//Obtener datos del formulario de búsqueda
$this->get_fields_from_search_post();
//Generar consulta
if ($this->search_query[0] == '\\') {
//Guardar consulta para no modificar la variable
//que se mande denuevo al formulario
$query = $this->search_query;
//Se va creando la nueva query que se mandará mas tarde
//al formulario (se busca la siquiente ocurrencia de comillas)
$query = substr($this->search_query, 2);
switch ($this->search_query[1]) {
case '"':
$cadena = substr($this->search_query, 2, stripos($query, '"'));
//Preparar la cadena para volver a mostrarla sin caracteres de PHP
$this->search_query = stripslashes($cadena);
break;
case '\'':
$cadena = substr($this->search_query, 2, stripos($query, '\''));
//Preparar la cadena para volver a mostrarla sin caracteres de PHP
$this->search_query = stripslashes($cadena);
break;
default:
break;
}
}
//Generar consulta
$my_search = new search();
$empleados = new emps();
$query = $my_search->get_query($this->search_query, FALSE, $this->search, $empleados->fields_list);
}
//Buscar los empleados de la empresa en la que se está y coincidencia en id con los id de emps en drivers
$ADODB_FETCH_MODE = ADODB_FETCH_BOTH;
//crea una nueva conexin con una bbdd (mysql)
$this->db = NewADOConnection($this->db_type);
//le dice que no salgan los errores de conexin de la ddbb por pantalla
$this->db->debug = false;
//realiza una conexin permanente con la bbdd
$this->db->Connect($this->db_ip, $this->db_user, $this->db_passwd, $this->db_name);
//mete la consulta
if ($query != "") {
$this->sql = "SELECT laborers.* FROM emps, laborers WHERE (" . $query . ") AND emps.id_corp =" . $_SESSION['ident_corp'] . " AND emps.id_emp=laborers.id_emp";
} else {
$this->sql = "SELECT laborers.* FROM emps, laborers WHERE emps.id_corp =" . $_SESSION['ident_corp'] . " AND emps.id_emp=laborers.id_emp";
}
//la ejecuta y guarda los resultados
$this->result = $this->db->Execute($this->sql);
//si falla
if ($this->result === false) {
$this->error = 1;
$this->db->close();
return 0;
}
$num_emps = 0;
$this->num = 0;
$temp = null;
$this->laborers_list = null;
while (!$this->result->EOF) {
//Si hay más de un id_driver asociado a un empleado de la empresa evitamos que salga más de una vez,
//para ello por cada emp nuevo se incrementa en uno su contador
$temp[$num_emps][$this->ddbb_id_laborer] = $this->result->fields[$this->ddbb_id_laborer];
$temp[$num_emps][$this->ddbb_id_emp] = $this->result->fields[$this->ddbb_id_emp];
$temp[$num_emps][$this->ddbb_id_vehicle] = $this->result->fields[$this->ddbb_id_vehicle];
$temp[$num_emps][$this->ddbb_id_date] = $this->result->fields[$this->ddbb_id_date];
$laborers[$temp[$num_emps][$this->ddbb_id_emp]]['cont']++;
//nos movemos hasta el siguiente registro de resultado de la consulta
$this->result->MoveNext();
$num_emps++;
}
//while
for ($i = 0; $i <= $num_emps; $i++) {
if ($laborers[$temp[$i][$this->ddbb_id_emp]]['cont'] == 1) {
//Si aparece y cont es 1 entonces es la primera vez que aparece
//cogemos los datos del conductor (directamente de la BBDD)
$this->laborers_list[$this->num][$this->ddbb_id_laborer] = $temp[$i][$this->ddbb_id_laborer];
$this->laborers_list[$this->num][$this->ddbb_id_emp] = $temp[$i][$this->ddbb_id_emp];
$this->laborers_list[$this->num][$this->ddbb_id_vehicle] = $temp[$i][$this->ddbb_id_vehicle];
$this->laborers_list[$this->num][$this->ddbb_id_date] = $temp[$i][$this->ddbb_id_date];
//Tratamos los datos para poder presentarselos al usuario
$this->preparar_datos($this->laborers_list[$this->num][$this->ddbb_id_emp], $this->laborers_list[$this->num][$this->ddbb_id_vehicle]);
$this->num++;
} else {
$laborers[$temp[$i][$this->ddbb_id_emp]]['cont']--;
}
}
$this->db->close();
return $this->num;
}