background preloader

PHP 101: PHP For the Absolute Beginner

PHP 101: PHP For the Absolute Beginner

php - Using Flat Files (Writing) Learn how to write data into a text file with PHP and flat files. This may come in useful for those of you who have access to PHP but not any form of database. Flat files are essentially text files which store data, much like databases themselves ... the only drawback being many less functions, such as search, edit and all the other things possible with MySQL. The first thing your going to want to do is create the form that will get the users information that we want storing, this is very easy, if you do not know how to use forms refer to my HTML forms tutorial. <form name="input" method="post" action="<? This gives us an input box called . Now, we have our form, which will look like this; The next part of the code is where we write our data into the text file (flat file). The if statement checks that the form has actually been submitted before running the script. Ok, now what have we just done? - Open for reading only; place the file pointer at the beginning of the file. And there you go.

PHP/MySQL Tutorial Introduction For many people, the main reson for learning a scripting language like PHP is because of the interaction with databases it can offer. In this tutorial I will show you how to use PHP and the MySQL database to store information on the web and include it into your website. Before you read this tutorial you should have at least a basic knowledge of how to use PHP. If you do not yet know PHP, I suggest that you read our PHP tutorial before continuing. Why Would I Want A Database? It is actually surprising how useful a database can be when used with a website. Banner Rotation. You only really need three things to run PHP scripts which access MySQL databases. PHP also needs to be installed on the server. Finally, you will also require MySQL. If you cannot install (or your web host won't allow) PHP and MySQL you can still use another web host. Testing For PHP and MySQL There is a simple test for both PHP and MySQL. Now upload this to your webspace and go to i t in your browser. Part 2

Practical PHP Programming

Related: