skip to Main Content

Im running the latest version of XAMPP and its connecting to a MSSQL DATABASE with the most current drivers for PHP 7.3.8 the queries are being issued using sqlsrv_query() + sqlsrv_fetch_array()

Ok so I have a SQL Query I need to run from PHP which is:

$sql = 'SELECT distinct "Name" FROM vItem WHERE "Name" LIKE pkg%';

The above code doesn’t work and does not return anything but when I just run(below):

$sql = 'SELECT distinct "Name" FROM vItem';

It returns the values from the column it literally breaks after adding “WHERE” to it.

2

Answers


  1. Try this :

      $sql = "SELECT distinct "Name" FROM vItem WHERE "Name" LIKE 'pkg%'";
    
    Login or Signup to reply.
  2. Try this:

     $sql = "SELECT distinct "Name" FROM vItem WHERE "Name" LIKE 'pkg%'"; 
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search