Larry
Administrators-
Posts
5413 -
Joined
-
Last visited
-
Days Won
155
Everything posted by Larry
-
where initialize
Larry replied to x_wd11's topic in PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (2nd Edition)
You either initialize the variables before you reference them or maybe they should be coming from an HTML form. -
That means your SELECT query isn't working. You'll need to run it separately on the server to see what the results are (i.e., what the error is).
- 15 replies
-
- mysqli_num_rows()
- boolean
-
(and 4 more)
Tagged with:
-
Sorry for the delay. I wanted to remind myself of why I did what I did...which I may now remember. Maybe! I'm still a little bit confused b/c the page numbers you reference for the "Effortless E-Commerce" book don't match up with those in the printed copy of the 2nd edition. But I think I get what's going on...by looking at the SQL commands for the second example in the "Effortless E-Commerce" book, (which is the one with "customers" and "orders" tables). Foreign keys are a (normalized) database concept, in which a column in table A represents a column from table B. There are also foreign key *constraints*, which is an aspect of the database application, enforcing the existence of a foreign key. This is what you're seeing on page 197- in the "PHP and MySQL" book. The SQL in the "Effortless E-Commerce" book has foreign keys but not foreign key constraints. There's a tip on page 193 that says you could add these. As a rule, a database must have foreign keys in order to use foreign key constraints but a database can have foreign keys without foreign key constraints. Separately, and perhaps the confusion here, MySQL will use the word "KEY" as synonymous with "INDEX". This is just saying that MySQL should index--i.e., track--the values in that column. Because, as a good rule, you should index foreign key columns. So! The reason everything seems to be behaving differently for the "Effortless E-Commerce" tables is because they don't have foreign key *constraints*. Let me know if this is still not clear or if you have any other questions (and I'll reply more promptly, I promise!).
-
Second Normal Form
Larry replied to rswcj's topic in PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
Good question! Actors have a many-to-many relationship with movies because each actor can be in multiple movies and each movie has multiple actors. A rule in this model is that each movie only has a single director, so there's a one-to-many relationship between directors and movies (although in real life some movies have more than one director these days). -
Well, different technologies go through trends although that tends to be more impactful to new businesses and work b/c, say, an existing PHP company/site is going to need a PHP person. We're definitely in a time wherein there's a lot of talk about server-side JavaScript. That may stay or go, though. And it's totally fine. I think all arguments about X language encouraging bad code are pretty silly. You can be a good or bad programmer in any language! Your best bet would be to look at some actual job markets, whether it's for full time jobs or freelance work, and see what they're actually looking for. I suspect you'll find no clear winner or loser. For what it's worth, generally speaking companies with existing IT departments will likely have opinions on what tech they want to hire for, but on the other hand, I work for a company that's primarily a Ruby shop and they hire more than just Ruby developers. If you're a good developer in any one language, there's potential for you to be a good developer in another. Developers understand theories and practices; languages are largely a matter of specific syntax. Finally, in my previous experience, many of the people hiring a developer for a project don't know or care what tech you use so long as you can do the job at the right price.
-
Undefined Index: Description
Larry replied to dmx1's topic in Effortless E-Commerce with PHP and MySQL
You're getting this error because the $row variable doesn't have an element indexed at "description". $row comes from the stored procedure, so either there's likely a flaw in your stored procedure definition. -
Review And Pursue
Larry replied to Larry's topic in PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
Sure thing! If you work it backward, the title is set in the HTML HEAD, which means it's in the header file. So, due to the way includes work in PHP, the script would need to have the user information prior to including the header. -
Chapter 7 Pursue
Larry replied to asexynerd's topic in PHP for the Web: Visual QuickStart Guide (4th Edition)
Just open the unordered list before the foreach loop and close it after. Then, within the loop, print $day within <li> tags instead of using break. -
Knowledge Level
Larry replied to Fothered's topic in PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
Thanks for the question and for the nice words! I would say in terms of familiarity with the concepts, you'd be an intermediate PHP developer by the end of this book. Maybe a low-end intermediate if I'm being conservative. The main thing you'd need from there is practice and experience, which no book can give you. Just a matter of doing now! -
So sorry for the delayed reply! This one somehow slipped past me. Are you still confused by this/still need some insights or did you figure it out while I was daydreaming? Apologies gain for missing this!
-
Thanks for your question! The difference between the 5th and 4th editions is somewhat minimal. The difference between the 5th and 3rd edition is significant. The difference between the 5th and 2nd edition is...oceanic! The 2nd edition is probably about 10 years old and I don't even know if PHP 5 existed then (the current version is PHP 7). So much has changed!
- 1 reply
-
- 5th edition
- 4th edition
-
(and 2 more)
Tagged with:
-
Hmmm... I've not been in this situation before but I imagine you have three options: - Uninstall MySQL and XAMPP and then reinstall XAMPP - Try to configure XAMPP to use your existing MySQL install (I have no idea what that would entail) - Just install Apache separately and forgo XAMPP I'm not sure which is best for you, it would depend in part upon how the current MySQL install was used and whether you want the easy solution or the "interesting" one!
-
Ah! Good question! The reason is because we don't want to assume the data will come from the form or in an unadulterated way. It'd be really easy to submit data from elsewhere to this script or to modify the form in the browser and then submit that. So these conditionals provide an extra layer of security.
-
In answer to your question, the concise.css might have another class later on that's conflicting. Your best bet is probably to move on (CSS is hard if you don't do it fulltime and it's not critical to your learning at this point). Second to that, I'd use the developer tools in Chrome to see what CSS rules are or are not being applied.
-
No image available.
Larry replied to nomadsoul's topic in Effortless E-Commerce with PHP and MySQL (2nd Edition)
That's all good info! The files should be just numbers without extensions, that's good. The next thing I'd do is run view_print.php?pid=1 directly in your browser and see the result. Hopefully you'll see a PHP error that explains what's going on. -
No image available.
Larry replied to nomadsoul's topic in Effortless E-Commerce with PHP and MySQL (2nd Edition)
What is the HTML tag for one of the images that's not showing?