Thanks for that sszettella getting close but it still will not work; looking at it I think I have to have the first part of the query ? returning something as if it is empty or not found the other AND, OR do not cut in.
PHP Code:
WHERE symptom='$symptom'
I suppose I could have another column that will always has the same result and do the original query on that ?
More thought required today I think. Some other thoughts I had last night below.
Anthony
Below is the query I think I want written out in a simpler way ?
PHP Code:
$result=MYSQL_QUERY
(" SELECT * FROM hardware WHERE ( if $manufacturer > '' manufacturer = '$manufacturer' )
(if $error > '' AND error = $error)
(if $symptom > '' AND symptom = $symptom )
(if $component > '' AND component= $component )
ORDER BY referance") or die (mysql_error());
Another thought is do the first query which will then give me an array with all the referance numbers of rows that contain the error. I would then need to do the next query on the sypmtom using the results returned from the first query and so on.
PHP Code:
if ( $error > ''){
$result=MYSQL_QUERY
(" SELECT referance FROM hardware WHERE error='$error' ORDER BY referance ")
or die (mysql_error());
}
if ( $symptom > ''){
while ($row = mysql_fetch_array($result)) {
$result=MYSQL_QUERY
(" SELECT referance FROM hardware WHERE referance = $row['referance'] AND symptom='$symptom' ORDER BY referance ")
or die (mysql_error());
}}