Hi,
I can't seem to get an ordinary variable query for a text string to work together with a comparison operator. They both work fine separately, as in:
SELECT *
FROM A, B
WHERE A.id = B.id
AND name LIKE '$name%'
AND type LIKE '$type%'
or in:
SELECT *
FROM A, B
WHERE A.id = B.id
AND from_date <= '$year%'
AND (to_date >= '$year%'
OR to_date = '' )
but no records are found, when put together:
SELECT *
FROM A, B
WHERE A.id = B.id
AND name LIKE '$name%'
AND type LIKE '$type%'
AND from_date <= '$year%'
AND (to_date >= '$year%'
OR to_date = '' )
the query does work if I am logged in to the mysql server, but not when I pass the query using PHP.
can anybody help?
thanks, LEX
I can't seem to get an ordinary variable query for a text string to work together with a comparison operator. They both work fine separately, as in:
SELECT *
FROM A, B
WHERE A.id = B.id
AND name LIKE '$name%'
AND type LIKE '$type%'
or in:
SELECT *
FROM A, B
WHERE A.id = B.id
AND from_date <= '$year%'
AND (to_date >= '$year%'
OR to_date = '' )
but no records are found, when put together:
SELECT *
FROM A, B
WHERE A.id = B.id
AND name LIKE '$name%'
AND type LIKE '$type%'
AND from_date <= '$year%'
AND (to_date >= '$year%'
OR to_date = '' )
the query does work if I am logged in to the mysql server, but not when I pass the query using PHP.
can anybody help?
thanks, LEX