simple PHP code | No Comments | October 22nd, 2020
Creating a simple feedback form using PHP
Creating a simple feedback form using PHP is very easy, thanks to PHP’s prebuilt mail() function. In this tutorial I’ll show you a complete, working example.
Firstly, lets create the HTML portion of the form:
This is a [...]
....Read More
See how to use .htaccess and mod_rewrite to easily transform ugly PHP URLs into search engine friendly ones.
The coming together of PHP and MySQL to create dynamic pages is a wonderful thing. Instead of having hundreds of separate webpages, your entire site can be stored inside a MySQL database, and then retrieved and displayed using [...]
....Read More
What is a Loop?
Looping is simply a way for you to reduce the amount of code and/or content you have to write out. The idea is that you have something you have to do, or some content you have to show, and instead of just “writing it all out,” you find a pattern to it [...]
....Read More
Article | No Comments | October 17th, 2020
Including Files Based on Input
If you’re including files based on user input you must think carefully about the security implications of this. When I say user input, I mean any value coming from outside your PHP script that is used in the formation of a file path. This could be as simple as a user clicking a link containing [...]
....Read More
Article | No Comments | October 17th, 2020
Basics of the Configuration File
Here is a quick way to create a configuration file from the web, used to initially setup an application or that can be expanded to allow users to modify the configuration later.
We will take advantage of the PHP’s ability to include code into an existing script. Instead of creating an initialization file that must be [...]
....Read More
Article | No Comments | October 17th, 2020
Using SQL to Copy Table Content
How to copy the contents of one table to another using SQL is not immediately obvious.
Create and Populate Table
create table mytablecopy select * from originaltable
Copying a Table into an Existing Table
insert into originaltable select * from mytablecopy
Sub-Selects
MySQL doesn’t yet support sub-selects. For example you cannot do this:
select * from things where [...]
....Read More
Article | No Comments | October 17th, 2020
Displaying SQL Query Results
This quick tutorial illustrates using functions that generate HTML to create start and end table rows. This is a technique, creating three functions, two to create the start (including header row) and end table sections and a middle section generated by looping construct that outputs HTML table rows filled in with data. This is great [...]
....Read More