|
| |
PHP & mySQL Examples with Source Code
Welcome to our examples of both PHP coding alone, and also
PHP + mySQL Database examples. We hope these will allow you to
more easily develop sites containing these tools. Please remember
that we cannot edit/debug scripts you may write. These are programming
tools and do require more experience than standard HTML. If you need
a project done, we would be happy to give you a quote on the effort.
The following demos are now available at our site. Some of these
areas contain just plain files. Those ending in .php or .php4 are
actual scripts, to see the contents of the script look for the same filename
ending in .phps (php source):
- Date Display - This is an easy
example of how to put a date/time on one of your pages.
- Graphics Library - There is
a lot of different graphic functionality available. Creation of GIF files is
ONLY supported if you use the older PHP3 (files ending in .php3). Creation of PNG files and JPEG images
is ONLY supported in PHP4:
- GIF images -
This is an example of how to use the GD graphics library to create GIFs (using GD 1.5).
See the source here. We included the
image here
by just using the
above link as the 'src' parameter to an IMG tag.
- PNG images -
This is an example of how to use the GD graphics library to create PNGs (using GD 1.8.4).
See the source here. We included the
image here
by just using the
above link as the 'src' parameter to an IMG tag.
- JPEG images -
This is an example of how to use the GD graphics library to create JPEGs (using GD 1.8.4).
See the source here. We included the
image here
by just using the
above link as the 'src' parameter to an IMG tag.
- True Type Button images -
This is an example of how to use the GD graphics library, with True Type Font support to create text
buttons on the fly (using GD 1.8.4).
See the source here. We included the
image here
by just using the
above link as the 'src' parameter to an IMG tag.
- Graphing - How about a very easing graphing package, like this
. To see a complete directory listing, with examples and viewable source (just look at the
.phps file), click here.
- Whois Search - This example
shows a network connection via PHP. It also show how you can combine
an HTML form, and the form handler, ALL IN ONE FILE!
It contains the following source files:
- user_whois.php4 - The
HTML and PHP3 source for the form and the handler.
- whois.php4 - Some common
code to contact the InterNIC whois database.
- Stock Portfolio Management System - This system allows a user
to register for use. Sending E-mail to the site owner containing the registration
info. The user can then login and select different stocks to insert into
a portfolio. It allows user to search the database of available stocks,
and also to change the stocks in their portfolio.
NOTE - this example represents some "early" coding. It is NOT required
that the PHP braces "<?" include everything. Regular HTML does not have
to be included. If you wish to see a layout of the underlying SQL tables and data types,
here is the schema. You can also
see an example of running the mySQL interpreter. This demo contains the following PHP source files:
- subs.inc,
DB_subs.inc &
variables.inc - Common function to ease
HTML generation and to also pass lists to/from the database.
- login.php3 - The home page for the system.
Note the file extension of php3, this lets the Apache server
know this file must be passed to the PHP module for interpretation before
display at the browser. The PHP module is built into the web server,
so performance is excellent.
To allow you to see the text we have linked via another version of
the file.
- register.php3 - Displays the
registration page which collects user specific info.
- control.php3 - The general
portfolio control page.
- portfolio.php3 - Displays the users stock portfolio
- viewfunds.php3 - Interface to
the search function.
- search.php3- Demonstrates various
search functions.
- register2.php3- Contains more registration functions.
- funddetails.php3- Does a specific search to display details on a selected stock.
- password.php3- Allows portfolio users to change their passwords.
- delete.php3 - From here you
can delete your portfolio account.
- passwd.php3- PHP include file containing the variable definitions for $DBpasswd and $user
<? $DBpassword = "password"; $user = "username"; ?>
|