O'Reilly logo

PHP Advanced for the World Wide Web: Visual QuickPro Guide by Larry Ullman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a Database-Driven Graph

Now that I've covered the basics of image generation with PHP, which is surprisingly easy, I'll develop a more advanced application that creates a graph derived from stored data.

The example I'll use will be based on the sports pool application developed back in Chapter 1, Advanced PHP Programming. At the time, I wrote a script that created an array of how each player was doing to date. In this section and the next, you'll create a graph for each week's results instead. In the process, you'll see how to create different shapes in your image, including rectangles, dashed lines, and circles.

There are two functions for creating rectangles: imagerectangle() and imagefilled rectangle(). The latter obviously makes ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required