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 <> 0 or edat_a <> 0 or pretecon_de <> 0 or pretecon_a <> 0 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 <> 0 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