DOWNLOADS EXAMPLES SKINS DOCS SUPPORT
 
 

Making a 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."

queryWhere

This is the column name in YOUR database table that you would like to search ON .

Example:

queryWhere=your_id_column

queryValue

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.

Example:

queryValue=28

We put the two value pairs together by separating them with an ampersand (&).

Example:

?queryWhere=your_id_column&queryValue=28

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.

In the open browser window that contains Wimpy (which is currently displaying an empty playlist), tack on a query string to the end of the URL in the browser's address bar. Use any column name defined in your database table, and a known value.

Example:

http://www.yoursite.com/myWimpy.php?queryWhere=your_id_column&queryValue=28

It is probably a good idea to have some kind of view of your database so that you can know for sure that you are referencing a proper column name and a proper value. Usually, a database has a "unique id" column -- this is the easiest way to get things going since you won't have to worry about ms-spellings or invalid punctuation.

Requesting multiple values

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

Example:

queryValue=bob|sally|joe

Here are a couple more query string examples:

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

http://www.yoursite.com/myWimpy.php?queryWhere=your_id_col_name&queryValue=28

Example 2
To request multiple items based on the "id" column

http://www.yoursite.com/myWimpy.php?queryWhere=your_id_col_name&queryValue=28|90|232

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

http://www.yoursite.com/myWimpy.php?queryWhere=your_artist_col_name&queryValue=mike%20gieson

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

http://www.yoursite.com/myWimpy.php?queryWhere=your_fileName_col_name&queryValue=http://www/path/to/file.mp3

For queryWhere, use the column names that exist in your table, and NOT any of the reference values that you saw while setting up the config file.
 

IMPORTANT: For queryWhere, use the column names that exist in your table, and NOT any of the reference values that you saw while setting up the config file.

You may have noticed that in example 3 queryValue the "space" character was replaced with %20. %20 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 so on. 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.