Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8442809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:56:30+00:00 2026-06-10T08:56:30+00:00

My RESTful interface works fine until I try to pass a WHERE statement Example:

  • 0

My RESTful interface works fine until I try to pass a WHERE statement

Example:

perimeters that are passed:

SELECT = "this";
FROM = "that";
WHERE = " 'ID' = 332";

the URL might look like this

http://www.example.com/rest.php?SELECT=this&FROM=that&WHERE=’ID’=332

then in my php script

if (isset($_GET['SELECT']))
{
    $SELECT = $_GET['SELECT'];
}
if (isset($_GET['FROM'])) 
{
    $FROM = $_GET['FROM'];
}
if (isset($_GET['WHERE'])) 
{
    $WHERE = $_GET['WHERE'];
}

So Im thinking that the equals sign in the WHERE statement is messing it up. Would I be correct in this statement?

And if so what might be an alternative?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T08:56:31+00:00Added an answer on June 10, 2026 at 8:56 am

    RESTful interfaces are about resources that are permalinks. Exposing direct queries over your database does not encapsulate your storage layer and is not RESTful. It’s a transparent RPC mechanism over http to query your database (directly by the consumer).

    In your example:

    www.example.com/rest.php?SELECT=this&FROM=that&WHERE='ID'=332
    

    ‘that’ seems to be the resource, ‘this’ is the data on it and id is the unique reference to that object.

    So, to be more restful, consider:

    www.example.com/api/that/{id}
    

    The data returned contains the ‘columns’ or attributes

    {
        attr1:val1,
        attr2:val2
    }
    

    Your server can map that/{id} to a method which takes the id, formulates the necessary sql query, get’s the tabular data, populates an objects and returns it (serializing to json, xml, etc…)

    If you need to further filter, consider querystrng params to control the options (but not a sql where clause).

    www.example.com/api/that/{id}?option=val1&option2=val2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a RESTful service that, when I try to save a new record
I'm using cherrypy to mimic an existing RESTful interface. One requirement is that I
I have a WCF web service that implements a RESTful interface. We're using the
I have successfully implemented a restful service that works with my own client. Now,
I'm using dynamic attr_accessible as per this article: http://asciicasts.com/episodes/237-dynamic-attr-accessible It works fine. But I
I want to unit test a RESTful interface written with Apache CXF. I use
The recommended way to handle optimistic locking in a RESTful interface seems to be
I am writing restful web services and everything is fine, my web services are
I am building a RESTful service with Phil Sturgeon's library . It works like
I have a class function to interface with the RESTful API for Last.FM -

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.