Insertion doesn't (indeed, can't, since it includes no type information) create databases or tables.
INSERT statements are part of the
DML; you need to use a
DDL statement (specifically,
CREATE TABLE) to create a table. See
How to Create a MySQL Database and User for info on creating a DB on X10.
Any tutorial on PHP + MySQL will teach you very little about SQL and relational databases. Chances are, you'll miss out on the core concepts, causing no end of trouble. Better to find a source that deals with the relational model explicitly. "
Introduction to Databases and Relational Data Model" by Maurer and Scherbakov is basic and not perfect, but decent enough introduction (there's an older,
plain-HTML version of the text). See also:
Having the user, database, and table names all the same is a
smell, if not being outright incorrect (is there a table named "unfthrea_foo" in database "unfthrea_foo"?). Also, while databases and DB users on X10 must have a prefix, tables don't; you're free to name tables whatever you want.
For PDO to use exceptions, you must
set the appropriate
error mode. Otherwise, you need to use
PDO->errorInfo to get error information. Note the tutorial that you linked to goes over this. This is also a good example of why an interactive debugger is superior to debug scaffolding: the output is limited to what you explicitly record, while an interactive debugger lets you examine any data in scope at almost every step of the program.
The PHPPro tutorial (like many tutorials) does many things in the examples that aren't suitable for production code. In one respect, this is fine, as the code isn't intended for production. However, it must make explicit exactly what is only shown for example purposes and not suited for production. For example, the PHPPro tutorial doesn't go far enough when stating that "Normally we would not show [DB error messages] to the end user". It's not just not normal, it's bad practice, as it
discloses too much information, which is bad from both security and
usability perspectives. The PHPPro tutorial also makes liberal use of
SELECT * without going into why it's only suitable for examples and not production code. It also doesn't go into why DB access and data display should be handled separately in production code.
There's no explanation for this on the sites. They assume I get it right the first time and move on to the next lesson.
That's because a tutorial is, by necessity, incomplete due to length constraints. For a work on MySQL and PHP to be complete, it would be at least book length. Also, a tutorial on PHP+MySQL is about interfacing the two, not about how to use each by themselves. The tutorial doesn't go into PHP language topics (such as control statements and OOP), so why should it go into SQL language topics and relational design? (This, by the way, is another issue I have with the PHPPro tutorial: it covers too much about SQL statements, making the tutorial unfocused and murky. SQL should be learned separately from PHP.) Before you can use PHP+MySQL, you must understand how to use them separately so that you don't confuse things. Also, declarative and procedural languages are different beasts, and so learning SQL and PHP separately helps maintain this distinction. It shouldn't be until you've mastered the language paradigms that you should learn about equivalencies between them.