Hola a todos:
Intento realizar una consulta sobre una base de datos MYSQL (llamada contactos), que tiene varios campos, pero me interesa que la consulta se realice sobre 3 campos ciudad, tituloanuncio, descripcionanuncio, pero me arroja el siguiente error.
Query was empty
Alguna sugerencia, ? o código alternativo para realizar esta consulta?
Gracias.
Rafa.
Código PHP:
Ver original<?php require_once('Connections/contactos.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
}
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ?
intval($theValue) : "NULL"; break;
case "double":
$theValue = ($theValue != "") ?
doubleval($theValue) : "NULL"; break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$query_Recordset1 = "SELECT ciudad, tituloanuncio, descripcionanuncio FROM contactos WHERE ciudad LIKE CONCAT("%", TRIM(IF(LENGTH(TRIM($ciud)) > 0, $ciud, ciudad)), "%") AND tituloanuncio LIKE CONCAT("%", TRIM(IF(LENGTH(TRIM($titul)) > 0, $titul, tituloanuncio)), "%") AND descripcionanuncio LIKE CONCAT("%", TRIM(IF(LENGTH(TRIM($descr)) > 0, $descr, descripcionanuncio)), "%") ";
?>