 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Jeremy Cook's Blog: Handling Binary Data with PDO
by Chris Cornutt March 03, 2010 @ 14:48:56
Jeremy Cook has put together a quick guide for something that can be tricky when using PDO in PHP - handling binary data in the return from your queries.
I like the fact that if I needed to use MS SQL Server, Oracle or any of the other big RDBMS's I could use the same PDO syntax to access them rather than learning a new database access library. However, there do seem to be some bugs in PDO according to what I've read on the web. While I haven't encountered most of them and can't comment on them I'd like to write about one that I ran into the other day and how I worked around it.
He was storing images in the database and pushing the information into the database was working fine. When he tried to pull the contents back out, however, the information wasn't being handled correctly (according to the example in the PHP manual) because of a differing return value for the fetch call - sometimes it's a string but, in this case, it's binary data so it needs to just be passed on through.
voice your opinion now!
pdo database mysql binary data
Lorna Mitchell's Blog: Simple Database Patching Strategy
by Chris Cornutt March 01, 2010 @ 14:10:53
In a new post to her blog today Lorna Mitchell has a few suggestions for handling database patching when your application starts to outgrow its simple roots.
One problem that seems to need solving too often is how to keep databases in sync across different platforms, different developers working on a project, and deploying database changes along with code changes. There are lots of ways of approaching this, none of them are really excellent however and personally I tend to err on the side of simple being better. Fewer dependencies means a solution more likely to work on every platform (and no additional complications for the live platform). Usually this means patch files of some kind.
She outlines her usual approach - creating a table with metadata and version information, export the structure of the database in push it into a row, creating numbered patch files and keeping it all stashed away in versioned source control for easy access. Check out the comments for some more interesting ideas.
voice your opinion now!
database patch strategy tutorial
NETTUTS.com: ASP.NET for PHP Developers Part 2
by Chris Cornutt February 19, 2010 @ 10:50:40
NETTUTS.com has posted the second part of their series looking to help PHP developers understand a bit more about the world of ASP.NET. This second part gets a bit more advanced than the first part.
It's been a hard climb for me, as a PHP guy for many years, to get to grips with ASP.NET. However I've found many good things in the framework, and have come to appreciate the power of the C# language - without losing my love for PHP.
He talks about using a development method he's come up with (rather than ASP.NET WebForms or ASP.NET MVC) because of his standards for the output, their reliance on Javascript and why he chose to learn the base .Net framework. He shows how to create a master page (template), work with custom classes, hook the script into databases and handling user controls.
voice your opinion now!
aspnet tutorial masterpage classes database usercontrol
Brian Swan's Blog: Getting Started with the SQL Server Driver for PHP
by Chris Cornutt February 10, 2010 @ 10:32:17
Brian Swan has posted a new guide for those wanting to get started using the SQL Server driver for PHP in their application development. His target of choice for the example is a SQL Server Express database.
I'll build a web page that exposes enough of the driver functionality for you to understand the basics of connecting to a server, inserting and retrieving data, and handling errors. A quick note about simplicity: The web page I'll build in this post is very simple '" it's just a simple form, really. It collects information about people who are registering for some fictional event. I'm intentionally keeping it very simple so I can focus on the PHP code for using the driver.
He walks you through the full process - everything from the installation of the driver to creating the database and, finally, building the page that connects to the SQL Server database and inserts/selects data from the sample table.
voice your opinion now!
sqlserver driver tutorial express database
Ibuildings techPortal: Learning PHP 5.3 by writing your own ORM
by Chris Cornutt January 11, 2010 @ 15:28:00
In this new post from the Ibuildings techPortal today Peter Verhage suggests a good way to learn all about the new features in PHP 5.3 - build your own ORM system.
Creating an ORM for PHP is not an everyday task but writing one is a good way to improve your PHP skills, especially if you use some of the additional features PHP 5.3 adds to the language. There are many excellent ORMs (Object Relational Mappings) already in existence and for a real-world project it would probably better to use one of these, but this tutorial uses the task of creating an ORM as a way to take a look at applications for some PHP 5.3 features.
He makes use of namespaces, interfaces, static variable/method handling, magic methods like "__set" and "__unset" as well as abstract classes - all features of some of the latest PHP releases (5.2+). By the end you'll have a basic ORM layer that can do all of the usual CRUD operations as well as more complicated searching and a few things those familiar with the Zend Framework are used to.
voice your opinion now!
orm tutorial database feature
Matthew Turland's Blog: Database Testing with PHPUnit and MySQL
by Chris Cornutt January 05, 2010 @ 13:24:49
In a new post to his blog Matthew Turland looks at a contribution he recently made to the PHPunit project to help it support database testing without the need for dumping the contents of your database out to a CSV.
If you're using MySQL as your database, CSV has been the only format supported by both the mysqldump utility and the PHPUnit Database extension up to this point. My contribution adds support for its XML format to the extension. While this support was developed to work in the PHPUnit 3.4.x branch, it won't be available in a stable release until 3.5.0. In the meantime, this is how you can use it now.
There's four steps you'll need to do to get it installed - grab the latest from github, create the seed data XML file, make a test case extending PHPUnit_Extensions_Database_TestCase and run your tests against the database information.
voice your opinion now!
phpunit database testing mysql unittest
PaperMashup.com: Easy PHP Pagination
by Chris Cornutt December 22, 2009 @ 10:38:08
In a new post to Ashley Ford's blog there's a tutorial on paginating your data (from an array of data pulled from a database) with a simple PHP script:
I've had a few pagination scripts over the years but I thought i'd share the one that i'm currently using as it's a useful script to have in your toolbox. As a developer you'll soon find a need to paginate data when displaying contents from the database, and rather than use JavaScript which could require all the data to be loaded into the page on load, we can use PHP to ensure that we're only requesting the data that we need from the database.
Some sample code is included showing how to use the LIMIT statement (there's similar features in the other major databases) to only pull a subset of the data needed back into your script. Some CSS is also included to make it all look a bit. You can see it in action here and download the source here.
voice your opinion now!
pagination tutorial database
|
Community Events
Don't see your event here? Let us know!
|