![]() |
|
![]() |
|
www.southgatearc.org
|
|
|
PHP and MySQL - Adding dataThere comes time when your website tends to transcend the boundaries
of mere brochure type looks. There is a need to interact, to seem dynamic,
and to respond according to your visitor's behavior. You also want your
visitors to go through a list of offerings that run into hundreds. Creating
hundreds of web pages having a uniform layout for hundreds of products
can become an overwhelming task. Besides, it's not easy to browse so
many products sequentially -- you need a mechanism to conduct searches
or create sorted A saintly combination of PHP and MySQL can come to your rescue. Once you have created a database with a well-defined structure, you can enter records and use those records as refence. Here you can learn how to create an SQL database and its tables. Once you have a database ready, you need a form to accept data, and then a php file to put that data intothe MySQL table. First the form. Assume we have a file with an online form named form.html. Here's the form of the file: <form name="toSave" method="post" Once we have this form ready, we need to create the php file it calls, namely, save_it.php. Suppose the name of the database is "visitors" and the table in this database is "visinfo" with fields "name", "email" and "city". <?php // The above lines establishes a connection with the $querySQL = "insert into visinfo (d_name, d_email, d_city) values
($name, $email, $city)"; // The above statement generates an error if you have setup the table
in such a way that there should not be a duplicate entry. In my next article(s) I'll show you how to query your database and then show the results on the web page.
|
|
| |
|
| Home
| For
Sale & Wanted | Tell
a friend | Guestbook
| Cast Your Vote | Newsboard
| Amateur Radio
Forum | Links | Diary
Dates | | Games | SWLs | 'How To' Guides | Humour | Data Comms | Lottery | Amateur TV | Contests | Can You Help? | Contact Us | 10 Metres | | Clubs Worldwide | Subscribe to our Newsletter | | |
|
| |