0

I'm using the following query:

$p = mysqli_query($link,"select distinct PossibleCondition,Symptoms from  healthguide  where  Subpart REGEXP '^[A-D].*$'  like '%$poscon%' and  Order by PossibleCondition ");

It's giving me the following error:

mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in D:\xampp\htdocs\MMC\frame1.php on line 142

What should I do?

Servy
  • 197,813
  • 25
  • 319
  • 428

1 Answers1

0

You are undoubtedly getting an SQL syntax error in your WHERE clause. You can't chain together two conditions like the REGEX condition and the LIKE condition without AND/OR between them. Also the LIKE condition doesn't have anything it is being compared against. Finally, you have a stray AND before your ORDER BY clause.

The structure needs to be someting like

WHERE Subpart REGEXP '^[A-D].*$'
AND [some field] LIKE '%$poscon%'
ORDER BY PossibleCondition
Mike Brant
  • 68,891
  • 9
  • 93
  • 99