Jump to content

Help with one Query Syntax Please


jonnypixel

Recommended Posts

Hi,

 

I am wanting to live search by either buyers ID or buyers name But when i try to add buyers name to the query it wont work.

 

I have tried seperating filed names with a comma and also tried (field1,field2)

 

But dosent seem to work.

 

Im just trying to figure out how i can change this::

$query = "SELECT * FROM listingsmanager_buyers WHERE buyers_ID LIKE '$queryString%' LIMIT 10";

 

To something like this:: ( but actually one that works  :confused: )

 

$query = "SELECT * FROM listingsmanager_buyers WHERE buyers_ID AND listingBuyers_name LIKE '$queryString%' LIMIT 10";

Link to comment
https://forums.phpfreaks.com/topic/196326-help-with-one-query-syntax-please/
Share on other sites

$query = "SELECT * FROM listingsmanager_buyers WHERE buyers_ID AND listingBuyers_name LIKE '$queryString%' LIMIT 10";

 

did you try

 

$query = "SELECT * FROM listingsmanager_buyers WHERE buyers_ID & listingBuyers_name LIKE '$queryString%' LIMIT 10"; ?

 

I haven't seen AND used in a SELECT command string before.

 

or you may want to narrow it down with separate vars?

 

$query1 = "SELECT * FROM listingsmanager_buyers WHERE buyers_ID LIKE '$queryString%' LIMIT 10";

$query2 = "SELECT * FROM listingsmanager_buyers WHERE listingBuyers_name LIKE '$queryString%' LIMIT 10";

You want to find records where buyers_ID is like $queryString or listingBuyers_name is like $queryString?

 

$query = "SELECT * FROM listingsmanager_buyers WHERE buyers_ID LIKE '$queryString%' OR listingBuyers_name LIKE '$queryString%' LIMIT 10";

Hi again,

 

It seems there is more than one way to skin a cat...

 

Thankyou to

xcandiottix
and
PFMaBiSmAd

 

 

I tried both methods and it seems that 

PFMaBiSmAd
skinned the cat this time.

 

Thankyou again to both of you champions for your willingness to help.

 

John

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.