'How can I solve my Php - Mysql Filter query problem?
I have a problem. I have a mysql command as below. The information in the column I call $birim is not synchronized with the value in the $birim variable. It comes with other information.
What I want is this:
The birim is "that" and the search word is this or that or that.
I want to run a query of .
Please help me .
Thanks already for your help.
$aranacak=$_POST['aranacak'];
$birim="Kutuphane Adi";
$getir=$baglan->prepare("SELECT *
from eserler
WHERE birim=?
AND baslik like ?
OR esersahibi like ?
OR konu like ?
OR konum like ?");
$getir->execute(array($birim,'%'.$aranacak.'%',
'%'.$aranacak.'%',
'%'.$aranacak.'%',
'%'.$aranacak.'%'));
while ($getircek=$getir->fetch(PDO::FETCH_ASSOC)) {
#############################################
?>
Solution 1:[1]
First of all, thank you for your help and such a quick turnaround. With the help of WOUNDEDStevenJones and RiggsFolly I found my problem.
Solution to the problem:
WHERE unit=? AND (title like ? OR author like ? OR subject like ? OR location like ?)");
This way it worked correctly.
Thank you guys, thank you so much for everything.
I was about to go crazy. :)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Aksehir Akademi |
