Rewriting the Creating a CRUD Application with PHP tutorial cycle: help wanted!

I've been reworking the Creating a CRUD Application with PHP tutorials. The new version should be ready for 7.0 Beta 2 release. In the new version:

  • I replaced mysql functions with mysqli functions.
  • With the help of Christoper Jones, I've added OCI8 versions of the code for connecting to Oracle Database
  • I've fixed some old bugs and improved the tutorials overall.

In the course of this work, two things have come to my attention. These are two things that you can help with.

  • The title Creating a CRUD Application... is not very appealing.
  • The sample CSS used for Lesson 8 is terrible.

So first, can anyone suggest a new title? We have one suggestion already, internally: Creating a Database Application with PHP. But if anybody out there thinks of anything better, we will use it, and we will credit whoever first suggests the final title. I'll put up all suggestions in a blog post (keep it clean, people).

Second, I'm not really a CSS person. I could use some help with a better CSS. If anyone would like to submit a new CSS, please email it to me at, jeffrey dot rubinoff at oracle dot com. At the least, I'll credit the final submitter in the body of the tutorial. I'll also list all submitters here in a blog post.

The CSS and all images are available in the completed sample project, which you can download here. Feel free to submit a different set of images as well as a CSS, if you have some better ones lying around.

Please put any further suggestions for the tutorial in the comments. It would be nice to have a conversation about this. Those of you with access to our staging server can read the works in progress. And we can continue this conversation after the reworked tutorials are published.


I could give you a hand with the CSS, what do I need to do? I assume download the latest development release and update the CSS so it's prettier.

Posted by Mathew Davies on January 07, 2011 at 03:55 PM CET #

Does anyone still using mysqli functions directly?

I'd suggest Zend or at least PDO

Posted by Pet on January 07, 2011 at 04:11 PM CET #

Thanks! The sample project is not included in the distribution. You can download the complete Lesson 8, which includes the CSS and all images, from
I prefer to keep this tutorial framework-neutral. Chris Jones has an Oracle Database + ZF tutorial up at .

Posted by Jeffrey Rubinoff on January 07, 2011 at 04:39 PM CET #

Thanks! The sample project is not included in the dev build. I will edit the post to include a link to the sample project, including CSS and all images. I cannot put the link in the comment due to spam filter.
I prefer to keep this tutorial framework-neutral. Christopher Jones has a tutorial for Oracle Database and ZF, linked from the php learning trail (sorry, again, no links)

Posted by Jeffrey Rubinoff on January 07, 2011 at 04:42 PM CET #

I agree with Pet - it's time to use OO data access approach (PDO) even in beginner tutorials. PDO is very useful in CRUD applications. I also agree with Jeffrey not to use any framework, especially zend (slow development, slow applications, weak documentation, etc). I wish future for zf like for Win95 :-> so others may unlike another framework and wont read tutorial which is framework-specific.

Posted by Tomas V. on January 08, 2011 at 08:56 AM CET #

I have nothing against Zend per se, just that I prefer to stay away from frameworks entirely in this tutorial.
Well, I do show both procedural and OO-style mysqli. Sorry that I'm not familiar with PDO. I'll look into it for the future.

Posted by Jeffrey Rubinoff on January 08, 2011 at 10:54 AM CET #

I think it would be nice to add the database schema to all of the lesson pages as an sql file, so people who want to start from the middle would not search for it...

Yes it's easy to guess that the db scheme could be found under "creating the database" lesson but seeing a link for the db schema just near the "download lesson" link would make things easier...

And if I'm not wrong, no security measures are taken against SQL injection, XSS or XSRF. I think a simple solution should be implemented at least for SQL injection. Using PDO would help:
$stmt = $db->prepare("INSERT INTO fruits (name, price) VALUES (?, ?)");
$stmt->execute(array($fruit, $price));

For the tables, using the nbsp character is not a good solution for the empty cells to be shown as it takes some space and breaks the padding of the cell. You can use CSS instead: "empty-cells:show"

Posted by Ozan Hazer on January 10, 2011 at 05:40 AM CET #

Maybe Creating Database Driven Application with PHP

Posted by Piero Recchia on January 10, 2011 at 06:28 PM CET #

@Jeffrey: PDO is not a framework therefore using it will keep the tutorial "framework neutral"

I will agree with Pet, Tomas V and Ozan Hazer: Use PDO instead of mysqli.

In terms of PHP, replacing mysql functions with mysqli does not sound exactly as kind of upgrade. :)

Posted by schkovich on January 28, 2011 at 05:49 AM CET #

Well, I don't think I will be able to learn enough PDO in time for the beta2 release but I will look into it for the future.

Posted by Jeffrey Rubinoff on January 28, 2011 at 07:40 AM CET #

I will be glad to help.

Posted by schkovich on January 30, 2011 at 04:13 PM CET #

Well, it's live now. Thank you Piero, I used your title. And thank you Ozan, I used your sample project with CSS.
schkovich, what digging I've done seems to show that both PDO and mysqli are current, and which to use is partly a matter of preference and partly of use case. However I agree it would be very useful at the very least to have a PDO version of the sample, and I would love any help with this that you could provide. I think I'd rather keep mysqli in the tutorial for now, to match the use of oci8. (PDO for oci8 has a big THIS IS EXPERIMENTAL warning on it). I might switch to PDO in the tutorial instructions when the oci8 version is mature. Anyway, a MySQL PHP developer should be familiar with the basics of both mysqli and PDO, no? The mysql API on the other hand is clearly obsolete.

Posted by Jeffrey Rubinoff on February 18, 2011 at 05:22 AM CET #

It might be that choice is partly matter of preferences, unless you need to connect to, lets say, Oracle database. In this case, mysqli extension will be out of the picture and you can use OCI8 extension or PDO database abstraction layer.

Further on, I can't see that there is such similarity between myqsqli API and OCI8 API, that will justify using mysqli over PDO.

I guess that among 1.000 PHP developers 899 have no idea what they are doing but will just copy/paste the code that will match the current use case they are dealing with, while remaining 101 will have no problem using both, mysqli extension or PDO database abstraction layer.

Finally, regardless of the stated above, I do agree that at this point, it will be better to stick to mysqli. PDO support might be long term task and I will be glad to help.

Posted by schkovich on February 18, 2011 at 06:46 AM CET #

how can I help you email me

Posted by giorgo on March 05, 2011 at 01:23 AM CET #

I will get to PDO sometime, but right now I have a more basic problem.
My code for updating a wish entry in the database does not work. I do not understand why. I have got as far as determining that no value for $wishID (or $wish['id']) is passed to the update_wish function. Instead there is a notice about "undefined index id". There is no problem with the values of description or due_date for the same wish entry.
Anybody want to take a look at the sample at and tell me what the heck I've done wrong, I'll be very grateful.

Posted by Jeffrey Rubinoff on April 03, 2011 at 05:42 PM CEST #

public function get_wish_by_wish_id($wishID) {
return $this->query("SELECT description, due_date FROM wishes WHERE id = " . $wishID);

You forgot the id field here... Change the sql to:
SELECT id, description, due_date FROM ....

Posted by Ozan Hazer on April 04, 2011 at 12:38 AM CEST #

Thanks, Ozan. I was trying to replace SELECT \* statements earlier and screwed this one up. :(

Posted by Jeffrey Rubinoff on April 04, 2011 at 01:33 AM CEST #

Even though the title is very "slick" it is certainly to the point and says exactly what the tutorial is about. Leave it the way it is.

Posted by guest on May 07, 2011 at 07:46 AM CEST #

"Creating a CRUD Application with PHP" seems to be not appealing because "Database" is not present on it. But "Creating a Database Application with PHP" looks too vague. I'd suggest you use a mix: "Creating a CRUD Database Application with PHP" that, even redundant, is clearer. Maybe you could replace "CRUD" with "fully functional" or equivalent, but "CRUD" will mantain the link with the former excellent and weel known tutorial.

Posted by Francisco Viegas on May 14, 2011 at 07:37 AM CEST #

Wish List Sample Application:: PDO Flavor

Posted by guest on May 31, 2011 at 06:11 PM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed

This blogs is written by NetBeans developers who contribute to the PHP support mainly.


« April 2014