PHP is a language that runs on the server. Why should have PHP, the server put static resources html,css,js,img These are not good?
But this alone is too monotonous. How to get a bit of interaction, instead of looking at static things every day, so only PHP.
The book is to start with a chestnut, simple to say is to submit the form to the background, the background to get data, and then run PHP script, put the data to insert into the database, want to use when the tune out.
Form submitted to the background, with $_get or $_post (according to form submitted by the method decision) through the table sole name is the name attribute, and then put the data in a variable inside, backstage.
You can use echo directly to the foreground output HTML, such as echo "
Like what
index.php, it could be these things.
<!doctype html>PHP echo 123;? ></body>
The HTML part in the background unchanged, PHP to <?php?> inside the content run over, out of the HTML, and then the same output to the foreground.
Get the data back in the background and save it. Save it to the database, of course.
The basic operation of the database is also several.
1 Setting up a database
2 Selecting a Database
3 Creating a data sheet
4 Inserting data
5 Select data
Database and data table is the relationship between the set and the subset, no data table, all the data are thrown directly into the database to find Ah ...
1. Create database book;
2 use book;
3 CREATE TABLE Book1 (
Title varchar (30),
Author varchar (30),
Price varchar (30)
)
4 INSERT INTO Book1 (
Title,author,price
VALUES (' Good ', ' Mike ', ' $ ');
5 Select Title,author from Book1 or select * from Book1;
Of course, the fourth is to insert data into the data table, there is no front desk to come up with a data, we open the MySQL terminal inserted a piece of the. Trouble four, of course, to use PHP script.
How to use PHP script and MySQL interaction, hahaha haha, haven't seen. Read it and write it again.
[head First Php&mysql] reading notes-what is PHP