Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Pineco.de:
Implementing Custom Logic With Raw SQL In Laravel’s Query Builder
Jul 04, 2018 @ 17:19:35

The Pineco.de site has a new tutorial posted showing you how to implement custom logic with raw SQL in the Eloquent query builder in the Laravel framework.

Laravel’s query builder offers a nice way to work with raw SQL. We can use them in our where conditions and also in our orderings as well. Let’s see some examples where we can use raw SQL to implement custom logic for ordering the results.

The post starts with a brief mention of the difference between sorting and ordering results, noting that one happens on the SQL server and the other on the results collection. Next they show examples using raw SQL to order a query using both a simple and more complex condition. There's also a link to the official documentation for the raw methods for more information and examples.

tagged: custom logic raw sql laravel query builder tutorial

Link: https://pineco.de/implementing-custom-logic-with-raw-sql-in-laravels-query-builder/

Sameer Borate's Blog:
Raw vs. cooked PHP $_POST variables
Sep 20, 2010 @ 15:15:16

Sameer Borate as a new post to his blog today looking at some of the quirks he's found when dealing with the $_POST superglobal in PHP.

A little quirk of PHP $_POST var I encountered while fixing a Salesforce web-to-Lead bug. A Wordpress site was using a form to submit user requests to the Salesforce web-service. The form that submitted the data had the following fields along with the others. The problem was with the multi-select field, only the last value selected in the multi-select was getting captured.

He investigated and found that his code was echoing out all of the values, but wasn't using the "field_name[]" notation with the square brackets to send back multiple values to PHP. Changing this and trying again, he noticed it still wasn't working as expected (with Salesforce). He figured out they're using "raw" versus "cooked" handling of the POSTed variables. Check out the rest of his post to find out what that means.

tagged: post variable raw cooked salesforce handling

Link:

Adam Jensen's Blog:
Output Transformation in a Zend Framework Model Layer
Apr 06, 2009 @ 18:43:06

Adam Jensen has a new post to his blog today looking at a solution he's created to be able to access the raw input a user has entered.

I’ve run into a minor problem, and I’m not sure my solution is particularly ideal. See, the Zend_Form approach described above does a great job of implementing Chris Shiflett’s Filter Input, Escape Output principle...user input is filtered for invalid HTML before it’s ever saved to the model, and can then be escaped as appropriate in the view layer. But what happens if you need to be able to retrieve the user’s original unfiltered input later?

While working with the raw data could be dangerous, he has created a custom model that, through the getters and setters and doing validation/sanitization and the presentation layer rather than behind the scenes. It's not ideal but he's willing to take suggestions...

tagged: output sanitize filter transform getter setter raw user input

Link:

SitePoint PHP Blog:
CouchDb: document oriented persistence
Sep 07, 2006 @ 12:49:40

Harry Fuecks mentions an interesting project today on the SitePoint Blog - CouchDb - a stand-alone document store, accessible via XML REST.

Firing up the CouchDb server on Windows is a breeze—follow the README. PHP-wise, you need the new http extension which is most easily done on Win32 by grabbing the most recent PHP 5 release (5.1.6) and the corresponding collection of PECL modules.

The interface between CouchDb and PHP is REST - XML + HTTP - you can also point your browser directly at the CouchDb server (default - localhost:8080) and get around with a little help from the CouchDb wiki.

So, if it's Just Another Database, why should we pay attention? Harry notes (with a code example) that it's more about how it stores the information and not just that it does. His example takes in a POST request from a form and pushes it (raw data) into the CouchDb functions. He also gives an example of where this would be handy - in a wiki (like Dokuwiki) where the files are currently stored on the filesystem instead of in a database.

tagged: couchdb interesting document oriented persistence post wiki raw data couchdb interesting document oriented persistence post wiki raw data

Link:

SitePoint PHP Blog:
CouchDb: document oriented persistence
Sep 07, 2006 @ 12:49:40

Harry Fuecks mentions an interesting project today on the SitePoint Blog - CouchDb - a stand-alone document store, accessible via XML REST.

Firing up the CouchDb server on Windows is a breeze—follow the README. PHP-wise, you need the new http extension which is most easily done on Win32 by grabbing the most recent PHP 5 release (5.1.6) and the corresponding collection of PECL modules.

The interface between CouchDb and PHP is REST - XML + HTTP - you can also point your browser directly at the CouchDb server (default - localhost:8080) and get around with a little help from the CouchDb wiki.

So, if it's Just Another Database, why should we pay attention? Harry notes (with a code example) that it's more about how it stores the information and not just that it does. His example takes in a POST request from a form and pushes it (raw data) into the CouchDb functions. He also gives an example of where this would be handy - in a wiki (like Dokuwiki) where the files are currently stored on the filesystem instead of in a database.

tagged: couchdb interesting document oriented persistence post wiki raw data couchdb interesting document oriented persistence post wiki raw data

Link:


Trending Topics: