News Feed
Jobs Feed
Sections

Recent Jobs

News Archive
feed this:

DevShed:
Paginating Database Records with the Code Igniter PHP Framework
August 28, 2008 @ 07:57:51

DevShed continues their look at using the CodeIginiter PHP framework to build a sample application in this latest part of their series - a look a paginating the database results from a query.

As you may guess, however, Code Igniter comes bundled with a robust set of core classes, which can be used to perform all sorts of clever tasks, such as working with databases, performing file uploads, validating user-supplied data, and so forth. [...] I'm going to show you how to improve the MySQL-driven application developed in the preceding tutorial, since it'll be provided with the capacity for paging database records, via the pager class included with Code Igniter.

He starts by reviewing the previous part of the series, pulling the data from MySQL, then shows how to push that through the pagination component to create a simple user listing.

0 comments voice your opinion now!
codeigniter framework database mysql result query paginate



Arnold Daniels' Blog:
An alternative way of EAV modeling
July 31, 2008 @ 12:54:23

Arnold Daniels has posted some thoughts on a topics recently featured in a cover story by php|architect - EAV modeling.

I had seen this db structure in other project, but didn't know that it was called EAV. For those who don't read php|architect, EAV describes a method of saving a large set of attributes, only some of which apply to an individual entity. Normally you would create a table, with a row for each entity and save each attribute in a column. With EAV you save each attribute as a row.

He suggests two ways to do the modeling - the more "common" way and an alternative way that splits up the data types to make querying simpler (into scalars and arrays). A sample database structure and example query for it are included.

0 comments voice your opinion now!
eav modeling database attribute query common alternative method


Rob Allen's Blog:
Notes on Zend_Cache
July 11, 2008 @ 07:58:43

Rob Allen has posted a few notes about the Zend_Cache component of the Zend Framework to his blog today.

Recently I needed to speed up a legacy project that makes a lot of database calls to generate each page. After profiling, I discovered that 90% of the database calls returned data that rarely changed, so decided to cache these calls. One of the nice things about Zend_Framework is that its use-at-will philosophy means that you can use any given component with minimal dependencies on the rest of the framework code.

He shows how, using the Zend_Cache module (and friends Zend_Loader and Zend_Exception), he creates a caching class that can be called anywhere and is used to cache the results from the queries. His default lifetime is set to 7200 seconds - two hours - before the script needs to refresh the cache and get the latest updates.

0 comments voice your opinion now!
zendcache zendframework sql query results example code


Mike Borozdin's Blog:
Is PHPLinq As Cool As Real LINQ?
July 08, 2008 @ 11:14:28

In a recent blog entry Mike Borozdin takes a look at a version of a data query language implemented in PHP, LINQ, as PHPLinq.

I read about the PHP Implementation of LINQ called PHPLinq. Frankly, I was skeptical about it. Finally, I gave it a try. I still remain skeptical...Let me explain why

He includes an example of a query on an array and how it's "less correct" than a more true to form LINQ implementation. Despite reservations though, he still feels that this implementation of LINQ for PHP has some "cool features" in its own right and it worth checking out.

0 comments voice your opinion now!
linq phplinq test language integrated query


Mike Willbanks' Blog:
PHP Performance Series Maximizing Your MySQL Database
June 19, 2008 @ 12:01:24

Mike Willbanks has posted another part in his "PHP performance" series today. In his previous article, he talked about caching techniques including things like opcode caching and database memory tables. This time he talks about getting the most out of your MySQL database.

Application level SQL performance is much different than the performance of the SQL query itself but rather how it has been designed to work in the application. Many of the items I will be addressing in this area is designing your application to make less queries thus improving scalability and likely performance. However, performance does not always equal scalability as the same with scalability does not always equal performance.

He looks at a few different topics like lazy connections, iterating queries, need-based selects, normalization and a few simple things that you can apply to every SQL your application uses to optimize it as much as possible.

0 comments voice your opinion now!
performance series maximize mysql database tip sql query


Debuggable Blog:
How to Group By in CakePHP's new release Part 2
June 17, 2008 @ 10:21:44

In this new post to the Debuggable blog, Tim Koschutki points out the method for using grouping in your CakePHP application's queries (specifically in the new Release 2).

Having promised it in the first post on how to do Group By in CakePHP I worked on an array() version for the group statement in Model::find() calls. So I implemented it.

His code shows the calls to find() the grouped information and accompanying unit test assertEquals calls to check that the results are correct. His examples show a few different ways to accomplish the same thing.

0 comments voice your opinion now!
groupby database query cakephp framework assertequals


PHPBuilder.com.au:
Executing queries with phpMyAdmin
May 02, 2008 @ 11:18:36

PHPBuilder.com.au continues their look at using phpMyAdmin in this new part of the series today. This new article focuses on using the interface to make queries against the data in your tables.

The previous article gave you an overview of the phpMyAdmin interface and functionality. It's now time to dive in further and learn how to construct and execute queries.

They show (complete with screenshots) how to use the GUI to build the different parts of your query - a simple SELECT statement with a join pulling together the customer information and their addresses.

0 comments voice your opinion now!
phpmyadmin screenshot tutorial build query


Chris Hartjes' Blog:
Custom CakePHP 1.2 Pagination Queries
March 05, 2008 @ 20:54:00

Chris Hartjes has posted some custom queries that showcase the CakePHP framework's paginaton capabilities:

Okay, so it turns out that the paginate() method that is used to generate the data that you (oddly enough) paginate through takes the same arguments as Model::findAll(). So, if you want to use your own query, you simply create a 'paginate' method for your model.

His queries show the two parts of the equation - fetching the paginated results themselves and grabbing what the current page number is (like "page 7 of 23").

0 comments voice your opinion now!
cakephp pagination query framework page


Hasin Hayder's Blog:
Unexpected return value from Facebook FQL.query via PHP REST Lib
February 18, 2008 @ 12:06:00

Hasin Hayder had been working with the Facebook API and stumbled across a bug in an application they had created for the social networking site:

The method which we used to count number of friends of a specific user who has added that application was returning 1 when there is no friend actually installed it.

He gives the SQL query and the PHP code he was originally using to find out the number of users for the application. The problem came from the fact that the returning value wasn't an array - it was a string. The corrected code (that checks for array-ness) is also included.

0 comments voice your opinion now!
facebook query rest library return value array string


Maarten Balliauw's Blog:
LINQ for PHP (Language Integrated Query for PHP)
January 24, 2008 @ 08:45:00

Maarten Balliauw has posted about an interesting new development he's made and is sharing with the PHP community - PHPLinq (Language Integrated Query).

Perhaps you have already heard of C# 3.5's "LINQ" component. LINQ, or Language Integrated Query, is a component inside the .NET framework which enables you to perform queries on a variety of data sources like arrays, XML, SQL server, ... These queries are defined using a syntax which is very similar to SQL. [...] I thought of creating a similar concept for PHP. So here's the result of a few days coding.

The library is available for download and some examples are included to show it in action (both in a simple example and in a more complex search on a series of objects).

3 comments voice your opinion now!
linq array object search query language phplinq library



Community Events











Don't see your event here?
Let us know!


database code application package job developer security ajax zendframework mysql cakephp release example framework conference PEAR zend releases book PHP5

All content copyright, 2008 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework