PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
$query = "Select * from individuals where MotherId like '%".$iName."%' or FatherID like '%".$iName."%' ";
I am getting an "unexpected FatherID" error message. FatherID is of course an attribue of the queried table. The query works as long as I do not have the OR condidtion. That is, the following query works.
$query = "Select * from individuals where MotherId like '%$iName%' or FatherID like '%$iName%'";
Only other thing I can think either $iName has weird characters in it (if so escape them first) or fatherID is for some reason a reserved keyword in mysql.
I should be able to help you further once I see the exact error.
I do see though that you have "Motherid" and "FatherID". Should the "FatherID" be "Fatherid"? That can make a difference as field names are case sensitive.
____________________________________________________
Jade, he is not incorrect in the way the query is written. He is using string concatenation which is perfectly fine. I actually prefer to do it that way versus using the variables inside the quotes because I use a syntax highlighting editor which allows me to better see where I have variables being inserted into strings. I see it like this:
$query = "Select * from individuals where MotherId like '%".$iName."%' or FatherID like '%".$iName."%' ";
versus like this
$query = "Select * from individuals where MotherId like '%$iName%' or FatherID like '%$iName%' ";