 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
SpeckBoy.com: Getting Started with CRUD In PHP
by Chris Cornutt February 18, 2011 @ 12:10:10
On SpeckBoy.com there's a new tutorial posted that introduces you to the concept of CRUD - Create, Read, Update, Delete - in the database interface for your application. Technically CRUD can be applied to any sort of data store, but they chose to go with a MySQL-based example.
It has become a common necessity for website owners to collect data and manage it properly. Creating a MySQL CRUD class allows you to conveniently create, read, update and delete entries for any of your projects, indifferent of how the database is devised. CRUD allows us to generate pages to list and edit database records.
So, in this tutorial I will show you how to build a simple CRUD web app, that will empower you with the basic functions of database management.
They briefly walk you through the setup of a XAMPP server to use as a base and give you the settings needed to create a simple users table. The rest of the post is the code you'll need to make the connection from your PHP script, insert data into the table, update them, remove the rows and display their contents. They've wrapped it all up in a single "index.php" file to make it simpler.
voice your opinion now!
crud database mysql tutorial create read update delete
Jani Hartikainen's Blog: How to create Doctrine 1-style Soft-Delete in Doctrine 2
by Chris Cornutt December 06, 2010 @ 13:02:08
Jani Hartikainen has posted his technique for making the Doctrine version 1 style "soft delete" in your Doctrine 2 powered application.
Doctrine 1 has the concept of behaviors which you could add to your models. One of these was the soft-delete behavior, which allowed you to "delete" records without really deleting them. Doctrine 2 does not have behaviors due to various reasons. However, I needed a way to have a model which worked like soft-delete. Let's see one approach to creating such behavior in Doctrine 2.
He introduces the idea of a "soft delete" - essentially a flag that gets set to let the rest of the application think that row is essentially deleted. He shows you how to create the similar functionality via a repository that filters the data for you. He includes code to help you along, defining the find/findOneBy/findBy and the example repository that lets you set an "is deleted" property on the object.
voice your opinion now!
doctrine soft delete repository filter
Zend Developer Zone: Deleting indexes from Zend_Registry and why you shouldn't do it !
by Chris Cornutt October 15, 2010 @ 09:19:47
New on the Zend Developer Zone today there's a post that looks at working with the Zend_Registry component of the Zend Framework and how deleting the index out of it directly could be a bad thing for your application.
Zend_Registry is the implementation of the Registry design pattern in the Zend Framework. It is similar to the $_GLOBALS array in pure PHP , but unlike it, it does not provide a transparent way to unset values at a specified index. As you will see in this short article, there is a very simple way to do it, but that doesn't mean it should be done.
He advises against directly using the "_unsetInstance" method that the component provides to remove items from the registry but that could cause unwanted side effects with your data. Instead he recommends using the SPL ArrayObject interfaces and the "offsetUnset" method on the registry instance to drop the item. He ends with a word of warning, though - be careful what you remove in one part of your application because something, somewhere might be depending on it being there, set or not, to make another decision.
voice your opinion now!
zendregistry zendframework delete index opinion
Richard Thomas' Blog: Solar Framework Shorts - Deleting Caches
by Chris Cornutt September 28, 2009 @ 11:11:57
Richard Thomas has posted a new "short" for users of the Solar Framework to delete cached data.
This one is simple but sweet, In your Models directory you define your Models and the basic rules they follow but do you know you can also make changes at the record level. Solar is smart and if it sees a Test/Record.php when creating records for the Test model it will load that class, this allows you to do all kinds of magic.
His example shows how the script can automatically check, on pre-save, to see if the data is different than that in the cache and remove it if so. This cached data is replaced the next time through with the latest information.
voice your opinion now!
solar framework short delete cache automatic
Ian Selby's Blog: Making RESTful Requests in PHP
by Chris Cornutt May 15, 2009 @ 07:57:19
In a new post to his blog Ian Selby looks at working with REST requests in PHP. He includes some of the basics of REST too, for those not completely familiar with the term.
APIs have become a very commonplace part of many popular web sites and services...especially REST APIs. I've already discussed how you can roll your own REST API for your PHP apps, but I've also received countless requests to go over how to actually make RESTful requests. That's exactly what we'll take a look at in this article
His tool of choice is the curl extension, making it simple to create a class wrapper with methods like executePost, executeGet, setAuth and, of course, execute. He outlines the class and gives the code blocks that fit inside each of the major functions. In the end you'll have a class that can make GET, POST, PUT and DELETE requests and be able to correctly parse the response.
voice your opinion now!
delete post put get tutorial request rest
Kris Jordan's Blog: Towards RESTful PHP - 5 Basic Tips
by Chris Cornutt December 10, 2008 @ 12:08:27
Kris Jordan recently posted five tips to help you get a "more correct" REST interface in your application.
As we entered a programmable web of applications with APIs the decision to ignore HTTP gave us problems we're still dealing with today. We have an internet full of applications with different interfaces (GET /user/1/delete vs. POST /user/delete {id=1}). With REST we can say /user/1 is a resource and use the HTTP DELETE verb to delete it.
Here's the five (six?) tips:
- Using PUT and DELETE methods
- Send Custom HTTP/1.1 Headers
- Send Meaningful HTTP Headers
- Don't Use $_SESSION
- Test with cURL or rest-client
- Use a RESTful PHP Framework
voice your opinion now!
restful rest tip put delete custom header session curl framework
|
Community Events
Don't see your event here? Let us know!
|