Waarom doet dit het niet in een query

Gestart doorBoude4 reacties27 weergaven

5 berichten · pagina 1 van 1

Boude

Lid · Topicstarter

Berichten
2.837
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
De titel zegt het al:

WHERE voornaam LIKE ".$_POST[zoek] ."% OR achternaam = ".$_POST[zoek]."% OR merk = ".$_POST[zoek]."%

Voornaam doet het wel maar achternaam en merk niet..
0
Berichten
2.692
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php
$zoekquery[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]zoek[/COLOR][COLOR= #007700]];[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM tabel WHERE voornaam LIKE %$zoekquery% OR achternaam LIKE %$zoekquery% OR merk LIKE %$zoekquery%"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
?>


Moet als het goed is werken
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"
SELECT
    *
FROM
    tabel
HAVING
    (
        voornaam LIKE %zoekquery%
    OR
        achternaam LIKE %zoekquery%
    OR
        merk LIKE %zoekquery%
    )
"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
?>
0
Boude

Lid · Topicstarter

Berichten
2.837
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
@luuk

Ik krijg bij die van jou dat voornaam niet bestaad. In having clause. Maar ik db staat hij toch echt..

edit: Heb hem al wink
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
WHERE voornaam LIKE ".$_POST[zoek] ."% OR achternaam LIKE ".$_POST[zoek]."% OR merk LIKE ".$_POST[zoek]."%
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren