Every Tutorial Breaks My Heart

Every time I think I’ve found a forms/database tutorial that’s going to actually teach me something, it breaks my heart. Just one that explains it, that’s all I need. Just one single tutorial that works.

Am I just stupid? Maybe it’s just me.

Part 1

Here’s one of the latest I’m trying:

Screenshot of steps in a tutorial

Immediately, I have two questions:

  • How does this code execute? There’s no step explaining what this file should be called or where it should be placed. There’s no step or code declaring an event that triggers this code or accesses this file (whatever and wherever it is).
  • How is that secure? Having your username, password, and database name right there can’t possibly be secure. The most specific answer I’ve gotten to that question was to put it outside the public folder which, honestly, doesn’t mean much to me.

Is there no course, no tutorial that explains where stuff goes and how you access it? If there was a file that linked to this PHP file I’d know two things:

  • I’d know the relative location — where this PHP code lives and, hopefully, as a result, how it’s secure and even what it’s called.
  • I’d know what executes the code in this file. Probably.

Everything I find explains how to do a given task or program a given task in some fictional, hypothetical environment but not on an actual server. At best, it explains how to do it on a home/local server but never explains how to get it all up onto a real host.

Every time I think I’ve learned something, I find out it’s useless because, for example, most hosts don’t provide nodejs so you have to, simply, find one that does. That would have been nice to know before I bought my hosting months ago.

The last paragraph in the previous screenshot gave me some hope (but still frustrated me because I hate learning things out of order–couldn’t “how to connect to a database” have been the first step?

Another screenshot of steps in a tutorial.

Totally makes sense but I still don’t understand how it executes. I know enough to know that code just sitting there in a file doesn’t do anything by itself. Following this “connecting” code is a line inserting a row of information into the database table. Theoretically. I guess. But how? Why? No form is completed. No button is clicked.

Part 2

The following screenshots below are the other tutorial I was hoping would kickstart my geeky heart today. It explains and shows everything I’d want to know. I love it but to me, at this point, it’s still useless because I don’t know how to put those four rows into the table. Yes, I know I can use SQL commands in the Terminal or use PHPmyAdmin and I love doing both of those but I want to make sites and/or apps for users other than myself. I want a few files on my web server (my host–not just local at home on my Mac or laptop) for the following:

  • User completes a form that adds rows to a data base
  • User completes a form that retrieves rows from a database

Like, say, updating a contact list.

The PHP file below, however, seems to be in the same directory as the HTML file which means, unless I’m completely mistaken, the user can type the URL and see.

Another example of what frustrates me is why in the previous tutorial, the “command” (“function”? or, in the second, “variable”) mysql_connect is used but the example below uses $con = mysqli_connect. Someone answered me on reddit saying mysqli was newer (or something … I can’t even remember) and I recently read something else mentioning it but those explanations get lost amidst all my other questions because who gives a s**t if I can’t even get that far because of all my other unanswered questions?

I so wish there was a forms/php/mysql resource as awesome as Jon Duckett‘s JavaScript and jQuery book. But I feel I can’t even use any of the knowledge I’ve gleaned from Duckett’s book because all of that knowledge would be used to create a beautiful, awesome site SO A USER COULD INTERACT WITH A F***ING DATABASE and I can’t figure out how to do connect the site with the database!

And, I’d like to be able to this simple thing in a secure manner because if the data and/or site aren’t safe then who gives a f**k what I make the site do?

Somewhat better Tute screenshot 1

Somewhat better Tute screenshot 2

Somewhat better Tute screenshot 3

Advertisements

About jotascript

Aiming to please. Seeking to impress.
This entry was posted in Frustration, PHP, Web Development. Bookmark the permalink.

One Response to Every Tutorial Breaks My Heart

  1. codeinfig says:

    i think the reason its so common to see tutorials that are separate from installation / running a first example is sort of like this:

    you dont want to create a book-length tutorial that people assume is obsolete just because the install/run instructions have changed. they change a little too often for my taste, and the rest of what a tutorial is there to teach– hopefully doesnt.

    so the best place to put install/run instructions (imo) isnt a tutorial, but on an interactive site where people can ask questions, or at least the info can be updated more often.

    add to this that every platform is a little different, etc. so maybe youre doing this on an apple tv, and due to (i dunno, firmware or some security feature only on apple tv) the setup is totally unique and different, making any “built-in” run instructions look obsolete and the rest look “tainted” or old.

    as for security, i cant imagine thats secure either. you often have to learn the basics of performing a task before you even have a frame of reference to be able to secure it. again– the basics stay the same, but security methodology is something that updates more often… etc. (and this concludes my apologetics for the creation of tutorials with obvious sections not included.)

    Like

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