PHP President Parade o’ Victory

I knew I’d seen PHP and HTML code mixed together. I’ve seen PHP code create HTML tables for displaying results from a database. My form for inputting presidents is a .htm file so, naturally(?), that was the file format I used for the page to display my results which looked like this:

try1

As usual, I’m using several different tutorials. One of them showed the proper way to do this so I wrote a proper file/page with the .php extension which produced this:

try2

I was getting closer. My code was building the table but not inserting rows for my presidents.

While I was looking at my cPanel File Manager, an error log file appeared. Like a kid on Christmas, I opened it and saw the first two lines (it grew as I edited and tested my code) in the image below.

errorLog3

I solved one problem at a time, sometimes causing other problems while I debugged by trial and error. Eventually, because I paid close attention to the Error Log each time, I ended up here:

Yessss

Totally awesome, right? I’m totally Steve Wozniak and Bill Gates, right?

And, as it turns out, that double-inserting problem is a frequent side-effect of an opening tag looking like this:

<

instead of

<php

So let that be a lesson to you–code like you should, not like you’re being shown or told.

Now for some jQuery and Bootstrap to doll both pages up.

Advertisements

About jotascript

Aiming to please. Seeking to impress.
This entry was posted in MySQL, PHP and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s