The CMS that I built
would be based on PHP and HTML. To learn the basics, I took a course on
CodeAcademy and watched a 1 hour video on the introduction to PHP. Once I got
the basics, I used the information from W3schools to construct a simple
mechanism to pull information from a database.
Once I built the
simple mechanic, I realized that I was missing a database.
To
set up a database and run the PHP code, I had to set up WAMP. With WAMP
standing for:
W – Windows
A – Apache
M – MySQL
P – PHP
Following the
instructions I’ve used to set up Wordpress (which required WAMP to run if it
were to be hosted locally) and the previous blog I’ve written regarding the
setting up of WAMP (docaok5.blogspot.com), I managed to set up the application
relatively quickly.
| Setting up WAMP |
Once that was done I
ran the program and signed into phpmyadmin
to set up a database (default login would be user: root password: (empty)). From there everything was rather
self-explanatory and simple. Using common sense I created a database with the
name of “student_council”.
After that was done,
I then started building the program. There were three parts to the program:
inputing the information, connecting to the database, and finally, sending the
info to the database.
So first I had to
create an input form. This would be made solely out of HTML and would have PHP
applied to it later. Using the information from the database, I created three
text-boxes (First Name, Last Name, Email).
| Submitting information form |
Once that was done, I
made a simple file to connect with the database. This was created solely out of
PHP and requires the proper credentials to function properly. The main line of
code was “$conn = new mysqli($servername,
$username, $password, $dbname);” in order to check if the query was sent
successfully, I had to write an if
statement that would print out the problem.
No comments:
Post a Comment