I am trying to search for a data in an entire table but the result that it returns is the entire table.
I am using as query this:
SELECT * FROM c100
WHERE creado_por LIKE 'SILVA'
OR fecha_y_hora_de_creacion LIKE 'SILVA'
OR auditor_asignado LIKE 'SILVA'
OR nombre_beneficiario LIKE 'SILVA'
OR tipo_documento_beneficiario LIKE 'SILVA'
OR numero_documento_beneficiario LIKE 'SILVA'
OR radicado_interno LIKE 'SILVA'
OR sucursal LIKE 'SILVA' OR estado LIKE 'SILVA'
OR parentesco LIKE 'SILVA'
OR direccion_contacto_beneficiario LIKE 'SILVA'
OR ciudad_contacto_beneficiario LIKE 'SILVA'
OR telefonos_contacto_beneficiario LIKE 'SILVA'
OR radicado_ecat LIKE 'SILVA'
OR naturaleza_evento LIKE 'SILVA'
OR asesor LIKE 'SILVA'
OR subasesor LIKE 'SILVA'
OR tipo_de_ingreso LIKE 'SILVA'
OR numero_caja_archivo LIKE 'SILVA'
OR fecha_recepcion_documental LIKE 'SILVA'
OR nombre_victima LIKE 'SILVA'
OR tipo_documento_victima LIKE 'SILVA'
OR documeno_victima LIKE 'SILVA'
OR fecha_fallecimiento LIKE 'SILVA'
OR municipio_del_accidente LIKE 'SILVA'
OR ips_atencion_medica LIKE 'SILVA'
OR numero_spoa LIKE 'SILVA'
OR despacho_fiscal LIKE 'SILVA'
OR telefono_despacho LIKE 'SILVA'
OR causales_devolucion LIKE 'SILVA'
OR reclamacion_digitalizada LIKE 'SILVA'
OR soporte_radicadion LIKE 'SILVA'
OR fecha_radicacion LIKE 'SILVA'
OR fecha_notificacion_estado_auditoria LIKE 'SILVA'
OR fecha_vencimiento_subsanar_glosa LIKE 'SILVA'
OR numero_paquete_ecat LIKE 'SILVA'
OR entidad_financiera LIKE 'SILVA'
OR numero_cuenta LIKE 'SILVA'
OR fecha_expedicion_certificacion LIKE 'SILVA'
OR soporte_certificacion LIKE 'SILVA'
OR fecha_vencimiento_certificacion LIKE 'SILVA'
OR nombre_persona_firma_conjunta LIKE 'SILVA'
OR reclamacion_reprogramacion LIKE 'SILVA'
OR reprogramacion_realizada LIKE 'SILVA'
OR fecha_reprogramacion LIKE 'SILVA'
the user puts a value as search criteria and this is passed through a post to the php that performs the search, but as you can see in this example, SILVA is searched for and even so, it returns 100% of the table.
How can I search the entire table for a value X?
you should like '%SILVA%' to all fields since some you like an empty string so the condition is met anyway
The problem comes from the clauses
LIKE ''
, which are always match for each row of the table. Remove them from the query if you don't want to filter by those fields.