Ver Mensaje Individual
  #15 (permalink)  
Antiguo 04/08/2008, 15:51
Avatar de engonga
engonga
Usuario no validado
 
Fecha de Ingreso: marzo-2002
Ubicación: Buenos Aires
Mensajes: 1.300
Antigüedad: 23 años, 1 mes
Puntos: 8
Respuesta: filtrar por fechas

el problema es que la sentencia sql la hago dinamicamente


por que recibo datos de otros campos


lo que es la pre_SQL es donde tendria que poner lo que me dice?


Código PHP:
if categoria_prof <> "totes" or sexe <> "tots" or poblacio <>"totes" or comarca <> "totes" or tipu_jornada <> "totes" or edat_de <> or edat_a <> or pretecon_de <> or pretecon_a <> or actpas <> "" or alerta <> "0" then
coletilla 
" "
sql ="select * FROM CURRICULUMS where"

If categoria_prof <> "totes" Then
 sql 
sql coletilla "( categoria_prof1 = '" categoria_prof "' or categoria_prof2 = '" categoria_prof "' or categoria_prof3 = '" categoria_prof "')"
 
coletilla " and "
End If
If 
edat_de <> or edat_a <>0 Then
 
'sql = sql & coletilla & " data_naixement between #"& edat_inicial &"# and  #"& edat_final&"#"
 sql = sql & coletilla & pre_SQL
 coletilla = " and "
End If
If poblacio <> "totes" Then
 sql = sql & coletilla & " poblacio = '"&poblacio&"'"
 coletilla = " and "
End If
If comarca <> "totes" Then
 sql = sql & coletilla & " comarca = '"&comarca&"'"
 coletilla = " and "
End If
If tipu_jornada <> "totes" Then
 sql = sql & coletilla & " jornada = '"&tipu_jornada&"'"
 coletilla = " and "
End If
If pretecon_de <> 0 and pretecon_a <> 0 Then
 '
sql sql coletilla " pretecon  between "&pretecon_de &" and  "&pretecon_a
 sql 
sql coletilla " (pretecon => "&pretecon_de &" and  pretecon >="&pretecon_a&")"
 
coletilla " and "
End If
If 
sexe <> "tots"  Then
 sql 
sql coletilla " sexe = '"&sexe&"'"
 
coletilla " and "
End If
If 
actpas <> "" Then
 sql 
sql coletilla " actiu_pasiu = '"&actpas&"'"
 
coletilla " and "
End If
If 
alerta <> "0" Then
 sql 
sql coletilla " alerta = '"&alerta&"'"
 
coletilla " and "
End If
 
sql sql " order by codi"
else
sql ="select * FROM CURRICULUMS  ORDER BY CODI"
end if