News Feed
Sections




News Archive
feed this:

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

MaltBlue.com:
ZendDbSqlSelect - The Basics (Columns, Limit & Order)
July 02, 2013 @ 09:53:32

Matthew Setter has posted the third part of his series looking at the Zend Framework 2's DbSqlSelect component and its use. In this latest (and last) tutorial, he talks more specifically about columns, limiting and ordering.

Welcome to the third and last part in this series, introducing you to working with the ZendDbSqlSelect classes in Zend Framework 2. In part one we looked at building SQL Where clauses using the where related functions, predicates and closures, as well as compound queries. In part 2, we looked at all forms of SQL joins as well as a slightly more esoteric feature of SQL - UNIONS. Here, in part 3, in the words of Coldplay, we're going back to the start, and looking at the fundamentals.

He looks at three specific elements - the class constructor, the "limit" and "order" functions and the "Expression" class. He includes sample code showing how to create the class - one normally and one bound to a specific table. The next example shows how to define the columns to be selected using the "select" method. Finally, he shows the use of the "Expression" objects to perform SQL operations in the query (like "COUNT").

0 comments voice your opinion now!
zendframework2 db sql select series part3 column limit order

Link: http://www.maltblue.com/tutorial/zend-db-sql-the-basics

Gonzalo Ayuso's Blog:
Populating datagrid techniques with PHP
July 19, 2011 @ 09:25:46

In a new post to his blog Gonzalo Ayuso looks at the code required to populate a jQuery data grid with the records as pulled from a (MySQL) database.

Today I want to speak about populating datagrid techniques with PHP. At least in my daily work datagrids and tabular data are very common, because of that I want to show two different techniques when populating datagrids with data from our database. Maybe it's obvious, but I want to show the differences.

He uses "old school spaghetti code" rather than a framework to keep things simple and pulls the data from the database with a PDO connection. This information is then manually pushed into an HTML table and the data grid functionality is applied to it. The other method involves a little bit of JSON magic that the data grid library pulls in and populates for you, still appending rows to a table.

He notes that the second method seems faster to the user since the page and table are rendered first, but it also comes at the cost of more than one HTTP request.

0 comments voice your opinion now!
datagrid jquery technique preload ajax json


SitePoint PHP Blog:
How to Split WordPress Content Into Two or More Columns
February 05, 2010 @ 12:58:00

On the SitePoint PHP blog there's a recent post from Craig Buckler showing how to split up your WordPress content into two or more columns quickly and easily.

WordPress is a great CMS, but implementing some features within your theme can require a little lateral thinking. The content for your page or post is usually output by the theme code using a single function call. But what if you need to split the content into two or more blocks? That might be necessary if your theme requires multiple columns or sections on the page.

There's a built in call WordPress includes, "get_the_content", that returns the content rather than just echoing it out. With this handy function giving you just the content, you're free to split up the content however you want - on certain tags or as they suggest, using the "more..." tag and a few modifications to a few other scripts to split it out into DIV blocks.

0 comments voice your opinion now!
wordpress content tutorial split column


Chris Jones' Blog:
Inserting and Updating Oracle XMLType columns in PHP
July 13, 2009 @ 08:14:21

All of you Oracle users out there might want to check out this recent post from Chris Jones, especially if you've been using the XMLType columns in your tables.

Today a reader mailed me about manipulating XMLType columns when the data is longer than the 4K limit that character-type handling imposes. My free book (see sidebar) has examples of how to do this using CLOB handling in PHP. I noticed that my xmlinsert.php example in the book does a SELECT and UPDATE, but never actually does an INSERT.

To correct the problem of the missing example he includes example code to connect to the database, push the XML into a bind variable and select the row back out to ensure everything's still structured correctly. You need to set up a new descriptor for the insert to work (CLOB).

0 comments voice your opinion now!
clob column xmltype xml oracle insert


Sameer Borate's Blog:
Selecting all except some columns in MySQL
March 02, 2009 @ 11:13:08

Sameer Borate shows how to turn things around in your application's SQL statement and, instead of selecting the columns you need, showing how to remove the columns you don't need dynamically.

The MySQL SELECT is a ubiquitous statement. You can select rows using the '*' operator or by listing the individual column names. But many times you may require using all the columns from a table except a couple of them. For example you may have a table containing twelve columns from which you require only eleven columns.

Sometimes that extra column can contain larger content you might not need or want. He creates a get_column_names and create_statement functions that grab the column names and, based on an "exclude" array, takes out the unwanted records. The array is then looped through and appended back together as the new column list for the select.

0 comments voice your opinion now!
select exception mysql column array remove


Internet Super Hero Blog:
PHP 5.3 Persistent Connections with ext/mysqli
February 19, 2009 @ 09:31:33

The Internet Super Hero blog has posted some statistics comparing the connections per second that can be made with the newly introduced persistent connection support coming with PHP 5.3 in the mysqli (ext/mysqli) driver.

Persistent Connections have been a mixed bag. They can give you a significant performance boost by caching (pooling) connections although MySQL is already comparatively fast at establishing connections. However,connections are stored "as-is" in the cache. They are not "cleaned up".

The ext/mysqli driver takes care of this and a few other problems surrounding the persistent connections by cleaning up things like rolling back active transactions, unlocking tables, closing prepared statements and closing handlers. The trick is in a call to the C-API function mysql_change_user() (= COM_CHANGE_USER).

0 comments voice your opinion now!
mysqli ext driver persistent connection trouble solved statistic


PHP Women:
PHPWomen in php|architect
December 30, 2008 @ 09:38:02

According to this quick note on the PHP Women site, the group has been featured in the latest issue (Dec 2008) of php|architect magazine.

PHPWomen are featured in the December issue of the php|architect magazine, we're the subject of this month's /etc column! If you aren't already a subscriber - then go and check out the options, they even have a free issue offer so there are no excuses.

The column, written by PHP Women's own Lorna Mitchell, looks at some of the goals of the group, the work they do sponsoring female developers where they can, their mentoring programs and the communication methods - IRC and forums - that are open to all, not just female developers.

You can check out the issue here (and order a copy too!)

0 comments voice your opinion now!
phpwomen article column etc phparchitect magazine lornamitchell


Lee Blue's Blog:
How To Sort A Zend_Db_Table_Rowset
February 14, 2008 @ 17:11:00

Lee Blue has posted a handy tip for users of the Zend Framework, specifically when sorting the results from a query to tables linked in a Zend_Db_Table setup.

So you figured out how to define the relationships between your Zend_Db_Tables and you have issued a call to findDependentRowset(). You get your Rowset back but you need to sort the results by one of the columns in the dependent table. How do you do that?

Unfortunately, he's found out that you just simply can't - well, not without a custom function (until the 1.5 release of the framework rolls around). He shows his table set up and some sample database classes to relate to the tables (and link between them). The magic comes in with his DU_Utils class that takes in the data and sorts it based on the given column name in the given direction.

0 comments voice your opinion now!
zendframework zenddb table relationship sort order column


Zend Developer Zone:
Creating Data Tables With PEAR Structures_DataGrid
January 28, 2008 @ 16:19:30

Cal Evans has posted a tutorial on the Zend Developer Zone (posted today) about using the PEAR Structures_DataGrid package to create quick and easy data tables.

In this article, I'll be introducing you to the Structures_DataGrid package, showing you how it can be used to display structured data in tabular form. I'll be showing you how to hook it up to various data sources (including a CSV file, an RSS feed and an Excel spreadsheet), and how to format the resulting output so it's as pretty (or as ugly) as you want it to be.

They talk about what you'll need to get started (the different packages for different kinds of data) and some sample code to help you down the path to more attractive tables. There's even a bit touching on some of the more advanced features like exporting to Excel, pagination and data sorting.

0 comments voice your opinion now!
pear package structure datagrid table tutorial


php|architect:
January 2008 Issue Released
January 23, 2008 @ 16:34:00

This month's edition of php|architect magazine has been released - the January 2008 edition. Articles included in this month's issue include:

  • PHAR: PHP Archive Files from Gregory Beaver
  • Webmail 2.0: Introducing RoundCube by Tim Klampackel
  • Killing the For Loop from Paul Chandler
  • The Doctrine Framework by Nicolas Berard-Nault
  • and the usual columns - /Etc and Test Pattern

If you're already subscribed, you should be getting your issue any time now but, if you're not, there's two ways you can get your hands on a copy - either "quick buy" it from the php|architect website or subscribe and get this and other great future issues jam packed full of great PHP content.

0 comments voice your opinion now!
phparchitect magazine issue january release article column



Community Events





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


voicesoftheelephpant opinion series bugfix package podcast interview framework deployment list symfony introduction laravel api install release tips library language community

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