Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/07/2014, 19:28
relampago846
 
Fecha de Ingreso: mayo-2014
Ubicación: valparaiso, chile
Mensajes: 34
Antigüedad: 10 años
Puntos: 0
Pregunta buscador php mysql con mas de un campo a la vez

hola a todos necesito de su ayuda...
resulta que tengo un buscador interno php y mysql que solo me busca el campo nombre...
pero lo que quiero hacer es que me busque tambien en el los campos sinopsis, info e imagen, o sea que busque todos estos campos en un campo de texto
mas informacion: los campos son todos varchar excepto el campo info que es longtext
aqui hay parte del codigo php
Código PHP:
<?php require_once('../Connections/pelislatinofinal.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  if (
PHP_VERSION 6) {
    
$theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  
$theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  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;
}
}

$colname_Busqueda "-1";
if (isset(
$_GET['busqueda'])) {
  
$colname_Busqueda $_GET['busqueda'];
}
mysql_select_db($database_pelislatinofinal$pelislatinofinal);
$query_Busqueda sprintf("SELECT * FROM tbltodaslaspelis WHERE Nombre LIKE %s"GetSQLValueString("%" $colname_Busqueda "%""text"));
$Busqueda mysql_query($query_Busqueda$pelislatinofinal) or die(mysql_error());
$row_Busqueda mysql_fetch_assoc($Busqueda);
$totalRows_Busqueda mysql_num_rows($Busqueda);
?>
desde ya les digo que no se mucho de php, espero que alguien me ayude desde ya muchas gracias