Mission Statement
Here is what we offer
MySQL
PHP
Dreamweaver
Flash
Photoshop
Wednesday, August 5, 2009
What is SGS#15 with LCID 1033
Sunday, April 15, 2007
I love PHP and MySQL
Right now, I am in the middle of a project, a database-driven website, using PHP
/ MySQL. I can say that it is easy to me since I've been working with it for 2 years now and I'm enjoying it..
Thursday, February 8, 2007
Why use PHP and MySQL
Step by Step Web DB Sample Page. First we create a Table in MySQL
Creating the Table
To begin, you will need to create the MySQL table to store weblog entries. This example will use a table with the following columns:
- entrydate (TIMESTAMP) - this column will be automatically updated with the current date and time each time you add an entry. Since you'll be displaying entries by date, this field will act as the primary key.
- entrytitle (VARCHAR) - this column will store the title for each entry.
- entrytext (TEXT) - this column will store the text of each entry.
To create the table, you can use the following MySQL command. Enter it using the MySQL command-line interface or a front-end such as PHPmyAdmin. Before typing this command, type a USE command to select the database that you will be using.
CREATE TABLE weblog ( entrydate TIMESTAMP PRIMARY KEY, entrytitle VARCHAR(100), entrytext TEXT);
Second Step we create the HMTL Page. This is where we communicate with PHP
Creating the Add Entry Page
The weblog will use two PHP files: one to display the weblog to visitors, and another to add an entry. The addentry.php file will include the HTML to display a form for you to type an entry as well as the PHP code to store the entry in the database.
The HTML Form
Since this is a very simple weblog, we only need two fields in the form: a text field for the title of an entry, and a text area for the entry itself. You don't need to prompt for the date, since MySQL will assign it automatically. Here is the HTML for the page before adding PHP:
The Third Step is the PHP code which communicates with MySQL and display the data to HTML
The PHP Code
Now all you need is some PHP code to detect when the Submit button is clicked and save the entry in the database. Add the following after the tag:
Successfully Posted!"; else echo "ERROR: unable to post."; } ?>
This uses the mysql_connect and mysql_select_db functions to connect to the database. Be sure to specify your server, username, password, and database name. It then constructs a MySQL query in the $query variable, using the data entered into the form, and uses the mysql_query function to insert the data.