Like SQL with multiple fields [closed]

0

I want to make a select for a search of five fields (job title, training, sex, schedule, photo). But it's not working.

Could someone tell me the reason?

<?php

$cargo = $_POST['cargo'];
$formacao = $_POST['formacao'];
$sexo = $_POST['sexo'];
$horario = $_POST['horario'];
$fotografia = $_POST['fotografia'];

$sql = mysql_query("SELECT * FROM tbl_cadastro_curriculo WHERE ((cargo LIKE '%".$cargo."%') OR (formacao LIKE '%".$formacao."%') OR (sexo LIKE '%".$sexo."%')
            OR (sexo LIKE '%".$sexo."%') OR (horario LIKE '%".$horario."%') OR (fotografia LIKE '%".$fotografia."%')) LIMIT ".$ini.",".$fim);

if ($sql && mysql_num_rows($sql) > 0) {     
   ...
}            
?>
    
asked by anonymous 01.06.2015 / 20:59

1 answer

2

Here is the answer I found:

<?php
$total = mysql_query('SELECT COUNT(*)TOTAL FROM tbl_cadastro_curriculo' );

$cargo = $_POST['cargo'];
$formacao = $_POST['formacao'];
$sexo = $_POST['sexo'];
$horario = $_POST['horario'];
$fotografia = $_POST['fotografia'];

$sql = mysql_query("SELECT * FROM tbl_cadastro_curriculo WHERE ((cargo LIKE '%".$cargo."%') AND (formacao LIKE '%".$formacao."%') AND (sexo LIKE '%".$sexo."%')
            AND (sexo LIKE '%".$sexo."%') AND (horario LIKE '%".$horario."%') AND (fotografia LIKE '%".$fotografia."%')) LIMIT ".$ini.",".$fim);

if ($sql && mysql_num_rows($sql) > 0) {
   .....
}            
?>
    
01.06.2015 / 21:20