Using this article from Johannes Schluter as a starting point Vinu Thomas has worked up his own example of how the technique is used in the example on the Launchpad page.
This article is interesting because of the uses which come up when you can create custom Storage Engines using PHP. An interesting usecase for this is in creating test cases, where you can feed the data for a query from PHP and trap the activities on the database.
The example code defines methods for update, write and delete and the SQL to create the table and insert/manipulate rows is included (for a table created with "ENGINE=PHP").
In this new post to his blog Johannes Schluter looks at creating a storage engine plugin for MySQL via its plugin interface.
MySQL 5.1 has a plugin interface to easily add storage engines. PHP can easily embedded into other applications. So why not combine these two things? - Writing a MySQL Storage Engine which reads data by calling a PHP script.
He starts with a basic example with create_table and open_table functions that can pull the data from the table marked with the "Engine" setting of PHP. He expands on this to allow for more functionality - update, delete and write methods are added.
On NETTUTS.com, there's a list of twenty-five resources that can help you get started with PHP if you've never touched the language before:
PHP is a scripting language that is perfect for developing dynamic web pages and applications. You may be a PHP ninja, or perhaps you don't even know what PHP stands for. However, if you plan on or are involved in any kind of web development, you are bound to run into this fantastic and easy to learn web language. Today we will review 25 resources to get you started with PHP.
On the NETTUTS.com website today Alex Villmannwalks you through setting up a dedicated web server running Ubuntu, Apache, MySQL and PHP.
All great websites have a great server behind them. In this tutorial, I'll show you how to set up a dedicated web server (with Apache, MySQL, and PHP) using that old computer you have lying around the house and some free software.
The tutorial comes with plenty of screenshots for the Ubuntu install as well as the changes you'll need to make to the configuration files for the software to get things up and running. In the end you'll have a dedicated server you can drop anywhere and use to host your site.
We're in need for a full-time, deadline-driven PHP/MySQL developer who is familiar with open source technology, and has a good understanding of the Zend Framework. You must be an expert in PHP, CSS, and XHTML. You will be developing as well as maintaining various projects as needed for an online website built on a modified wordpress platform. A strong understanding of MVC and a strict adherence towards good programming is an absolute must.
You should be able to integrate a customer ticket/support system, affiliate system, and secure ordering system, as well as complete front-end customer interaction programs.
You will work out of our White Marsh, Md. office but there would be the opportunity to telecommute.
Position Requirements:
Qualifications:
4+ years experience building professional web applications
Proficiency with PHP / MySQL and database architecture
Zend Framework
Excellent verbal and written communication skills
Self-motivated
Well organized
Valued Skills:
Prior experience in the social networking industry
Proficiency with HTML/XML/CSS architecture
Project planning experience
Excellent writing and communications skills
Benefits:
Medical, dental and vision plan
Retirement plan with profit share
Project revenue share bonus
Send resume to Mickie Kennedy at zend@ereleases.com
Evert Pot has a quick post showing how you can make your code fork MySQL connections for better performance.
For some of our long-running processes we use PHP. It makes total sense from our perspective, because we can re-use all our existing business logic from our main PHP web application. To make things more efficient, I recently started some work on using forks and have a couple of worker processes around.
His sample script makes use of the pcntl_fork and pcntl_wait functions in PHP to spawn off processes that will be closed off when no longer needed.
On DevShed today, there's a new tutorial posted looking at two things that can cause headaches for PHP developers (especially when evaluating and comparing values) - nulls and empty strings.
Anyone who has programmed for any length of time has encountered the concepts of null and empty strings. They are not the same, and confusing the two can cause some serious problems. This article deals with these concepts in the context of PHP and MySQL.
They start with a bit of a quiz before getting into how to handle them correctly - making null "safe" and working with it correctly in a MySQL context. SQL statements and table structures are included for their examples.
IBM developerWorks has this new tutorial they recently posted looking at making a semantic CRUD (create, read, update, delete) application that uses MySQL and SPARQL.
Create, Read, Update, and Delete (CRUD) operations are the most basic database operations, but they are also the most crucial. CRUD operations are typically done using the Structured Query Language (SQL) on relational database systems. As the Web is becoming more and more data-oriented, there is a need to shift from SQL-based CRUD operations to semantic Web-based CRUD operations. Learn how to use PHP to perform CRUD operations over the semantic Web.
They include the SQL code for both sides (MySQL/SPARQL) on each of the CRUD steps. They take these and show how to plug them in to a PHP SQL call and briefly mention abstraction and a few reasons why you might want to move to SPARQL.
Justin Carmony recently put together a blog post looking at the biggest database design oversights that PHP developers can make in their applications.
I've thought of some of the biggest oversights I've had when working with PHP and MySQL and put them in a list. This is my personal list, and I'm sure some people can think of some other oversights that belong on the list as well. This list is just for PHP & MySQL, not PHP and any database. I know many people like using software like Doctrine to allow switching between different database types. That is beyond the scope of this article.
He includes a list of five - not having a data access layer, designing for only one database connection, not including developer logging, having queries written in procedural code and no separation of reads and writes to the database.
On the NETTUTS.com site, there's a new tutorial that looks to be a basic introduction to the world of Object-oriented programming in PHP.
Numerous examples from robots to bicycles have been offered as "easy" explanations of what OOP is. I've opted to show you how OOP works with a real-life example, for a programmer. By creating a MySQL CRUD class you can easily create, read, update and delete entries in any of your projects, regardless of how the database is designed.
Their CRUD example not only serves as an introduction to OOP, but can also be an introduction to MySQL support for those that haven't used it before. They create six functions - the four for CRUD and a connect and disconnect. The full source is available for download too.