1

I'm using PHP to access the NYS Attorneys data. This query works for the zip field:

https://data.ny.gov/resource/cdhq-buk7.json?$select=first_name, last_name, company_name, street_1, street_2, city, county, state, zip, zip_plus_four, judicial_department_of_admission, law_school, phone_number, year_admitted, status&$where=zip like '1403%'&$order=zip, last_name&$limit=50&$offset=0

However, this query for the last_name filed returns no data:

https://data.ny.gov/resource/cdhq-buk7.json?$select=first_name, last_name, company_name, street_1, street_2, city, county, state, zip, zip_plus_four, judicial_department_of_admission, law_school, phone_number, year_admitted, status&$where=lower(last_name) like 'smith%'&$order=last_name&$limit=50&$offset=0

I would appreciate any suggestions. Thanks, Jim...

  • 1
    I think the problem is the % sign in the `like` part of the statement, you need to change it to `%25` to get it to run. Not sure why the first one runs though. – Nigel Ren Oct 14 '18 at 17:48
  • Possible duplicate of [Pass a percent (%) sign in a url and get exact value of it using php](https://stackoverflow.com/questions/17342671/pass-a-percent-sign-in-a-url-and-get-exact-value-of-it-using-php) – Nigel Ren Oct 14 '18 at 17:48
  • Thanks! Turns out I had an issue in my PHP code. Many fields are empty or null so I had to put code to check if there was data in each file before I could display on a web page table. I am able to use the % wildcard at the beginning and the end. Few more features to add. Current work is at http://jimgerland.com/socrata/nysattorneys/index.php - I'm going to contribute it to github and socrata soon. Thanks again! – Jim Gerland Oct 15 '18 at 18:48

1 Answers1

0

Similar to Nigel's comment, removing the percentage sign in the last name will work or changing % to %25 will work.

Tom Schenk Jr
  • 478
  • 2
  • 8