Custom Query

To query a playlist, we send a "query string" into myWimpy:php. A query string includes a ? followed by any number of "value pairs." Each value pair is separated by a & symbol. When making a query with Wimpy only two value pairs are needed. The first value pair is queryWhere, the second value pair is queryValue.

FYI: The reason we call each one a "pair" is because each word (variable) has an associated value. In other words, queryWhere will have a unique value, so the variable queryWhere and it's associated value constitute a "pair."


This is the column name (or kind of data) that you would like to search ON .



You can use any one of the following column names (or kinds of data) to search on:

  • filepath
  • artist
  • album
  • title
  • track
  • comments
  • genre
  • seconds
  • filesize
  • bitrate
  • visual
  • myid
  • filetype
  • basename
  • add_date
  • year
  • votes
  • plays
  • rating
  • time
  • price
  • alt1
  • alt2
  • alt3



This is the value that you would like to search FOR .All the rows that contain the value defined for queryValue will be returned as a playlist to Wimpy using the SIFT playlist format.



To complete the "query string," we put the two value pairs together by separating them with an ampersand (&).



What you see above is a complete "query string." We can send the query string into myWimpy.php by simply adding it to the end of myWimpy.php. The ? symbol is used to delineate between the file name and the query string. If the ? is not included, the browser will not know how to differentiate between the the "query string" and the URL to the file. The end result is that without the ? your browser will issue an error.

Here is what the final URL, including a "query string" looks like:


Entering a URL like the example above will cause Wimpy to load one file. The file that has the "myid" value of "28."



Requesting multiple values

To request multiple values, separate each value with a "pipe" character.



Here are a couple more query string examples:

Example 1
To request a single item based on the "myid" column:

Example 2
To request multiple items based on the "myid" column|90|232

Example 3
To request all rows that have "Mike Gieson" in the artist column:

Example 4
To request an item based on the value defined in the "basename" column:

You may have noticed that in example 3 queryValue the "space" character was replaced with %20 -- this is the "URL encoded" equivalent of a space character, and it's probably a good idea to URL encode your queryValue, since often times there are apostrophes and weirdo characters in artist names / album names (and other values). Weirdo characters could potentially choke either PHP, MySQL or Flash, so by URL encoding the request, errors will be minimized.

You may also have noticed that lower case letters were used for queryValue. MySQL is case insensitive when it fetches rows, so you do not have to worry about using the proper uppercase / lowercase combination.

When making a query, be aware that in order for a result to be returned, the value must match the entire value. In other words, lets say row 3 has "Mike Gieson" in the artist field. If you sent in a query as queryValue=mike, then nothing would be returned. The only way to return row 3 based on the artist field is to match the exact value of that particular field. As mentioned earlier, the match does not have to be case sensitive, but all of the characters must match.






  ©Copyright Plaino LLC. All rights reserved.