Jump to content
Larry Ullman's Book Forums

Larry

Administrators
  • Posts

    5413
  • Joined

  • Last visited

  • Days Won

    155

Everything posted by Larry

  1. The code you posted doesn't show PHP echo'ing or printing the value of $id. What does the HTML source code of the page look like (specifically for that input)?
  2. Thanks, Gregory. And thanks for the very, very nice review at Amazon. Much appreciated! Feel free to post any questions you may have. That's what the forum is for!
  3. HartleySan, when people talk about self-publishing, they think about the amount of control and higher profits, but I honestly don't think it's feasible without already having some "base" or "following", be that Twitter or a blog or existing books. Ironically, by having already published 20 books (and the other promotional stuff I do), a self-published book of mine is much more likely to be successful today than one I could have written 5 years ago. I have that same O'Reilly book, although I bought mine about 10 years ago, so it's really outdated. Like pretty much all O'Reilly books, it's an excellent and exhaustive resource but not necessarily the best book to learn from. Thanks for your thoughts about JavaScript 2.0. I'm thinking of a way to make the purchase of a book qualify a person for free updates for life (or five years or something). That way, rather than trying to shoehorn discussion as to what JavaScript 2.0 will be into this book, I can just update the book when JavaScript 2.0 comes out. Of course, I can't provide free updates of printed books and maybe not those sold through Amazon so... Stuart, yes, I'm doing the JavaScript book first, then one on Yii (assuming the whole thing hasn't blown up in my face by then and I've decided to scrap the idea). From a business perspective, it'd probably be better to do the Yii book first, but I've been promising the JavaScript book for a long time and people want it. Plus, I already had the book outlined. Thanks everyone!
  4. Jonathon, I think I have a decent-sized "following", but to put that in perspective, if everyone currently subscribed to my newsletter and currently registered in this forum buys a copy of a self-published book, I'll basically make just about the bare minimum I would be guaranteed to make if I went with a publisher. And, of course, not everyone is going to buy a copy. On the other hand, if I sell as many copies of a self-published book as I have some of my best selling traditional books, I'll make a small fortune. Okay, not a small fortune, but it'd be quite beneficial. So I'm trying to approach this with open eyes. I am dedicating the bulk of this year to making this happen (and learning what I need to learn), so I'll make the time and am prepared to not make much money this year on that account. Better to have tried and failed...though. At the end of the year I'll have tried something new, learned a whole lot, and made somewhere between not that much money and a decent amount. In the grand scheme of things, that's a good year. And, yes, a self-published book on apps or whatever would make sense. Basically I don't learn anything these days without writing a book about it! Stuart, thanks for the input and for volunteering. Much appreciated. Will keep that in mind. In learning several languages and technologies over the past 12 years--PHP, MySQL, HTML, JavaScript, CSS, OOP, C, C++, Ruby, Flex, what I've figured out is this: what's really important is learning how to learn, understanding approaches to common problems, and knowing how to debug. Although there are cultural differences between, say, PHP and Ruby, at the end of the day, the biggest difference is just syntax. Once you understand UI and form validation and data storage, etc., it's largely a matter of capitalization and balancing parentheses and semicolons (or not) and such. So I'm not worried about tackling iOS when the time comes. Certainly, there's that last 20% of a technology, the mastery of which differentiates the capable programmer from the extraordinary one, but 80% of lots of programming languages are really common ground.
  5. You're quite welcome. That's what the forum is for. Thanks for your interest in my books!
  6. Thanks for the input! I've only barely looked into this, but clearly the printed book will have the biggest expense on my end, but I am dedicated to selling printed versions. I can generate PDF, epub, and mobi formats at no cost, really. The issue, then, is where the item sells from. If it sells from Amazon, they take a percentage of the price, like maybe 55%. I don't know what rights I'll have to sell things through my own site at a different price than Amazon. I have an amount in mind that I'd like to personally get per book (after expenses) and I have a maximum in mind that I'd feel comfortable with people spending (probably $15-$25, depending upon the format). So it's going to be a matter of striking the right balance between those two numbers. My (former) agent actually mentioned the apps idea to me, which I wouldn't have otherwise considered. But it would allow me to, I think, put demonstrable JavaScript with the book. In other words, you're reading the book, here's a bit of code, click this button to see the results in action. It's a whole bigger level of effort and knowledge involved (on my part), but it could be an excellent use of the app technology and a good way to set the book apart from others.
  7. Big thanks, Jonathon! I should get around to writing that alleged JS book. Out of curiosity, what format do you think you'd prefer it in? Printed, PDF, mobi (Kindle), ePub? I'm going to make it available in as many ways as possible, but would like to know. I'm even thinking about turning it into an app (both iOS and Android), down the line.
  8. Excellent idea, Jonathon! If this self-publishing thing works out, I guess there are a lot of books that I could do now that I've thought about doing over the years.
  9. You're quite welcome. That's what the forum is for. Thanks for the nice words!
  10. Alvaro, thanks for the nice words. By the way, it really sounds to me like you're duplicating a process. I haven't worked with CodeIgniter, but most frameworks use one key file (called the bootstrap) through which all requests go. Values are passed in the URL to tell the bootstrap which specific module to include. This is what I do in Chapter 2. So to me, it sounds like you're trying to emulate a framework-like system using a framework, when maybe you should just be using the framework and ignoring the approach in that chapter (which is kind of a watered-down framework)?
  11. Why would you remove that? That's the code that's supposed to work. Do you not understand what I mean by "print out what values the variables have"? It's critical, fundamental debugging. As I wrote two posts ago, just print out the values of the variables before that line. To be more explicit, add this code to your script (again, before the aforementioned line): echo "<p>Type = $type <br /> SP Type = $sp_type <br /> SP Cat = $sp_cat <br /> Category = $category </p>"; That's all I mean. Just print out the values of the variables so you can see what they are. Don't assign values to the variables and don't remove any code, just print out the values of the variables. Since that conditional is true, it means one of those variables doesn't have a proper value. The goal, then, is to determine which. Once you do that, you can work your way backwards to where the variables are assigned values to see where the problem is.
  12. You're welcome for the help. I should point out, before going further, that this book does not teach PHP and MySQL. If you don't have a solid understanding of those two technologies, you're going to struggle with the book. In fact, the book does teach some advanced PHP and MySQL, so I worry it may be over your head if you're just getting going. I trust your judgement on that, though.
  13. Sorry. My mistake. I added that to the Web version of the site so that people could provide feedback but I later disabled that feature. That code shouldn't be in there.
  14. Yes, you can use PuTty to SSH into your server and then use the command line mysql client, but only if your hosting company supports that. Not many shared hosts do. I personally use phpMyAdmin over the Web, but it's in a password-protected directory and the access information is already hard-coded into the installation. The problem with what you're doing is you're sending the MySQL info over an unsecure connection. So you should either secure the connection (use SSL) or get the access info written into the install. Or you could just write PHP scripts that do whatever admin you commonly need to do, and then place these behind a password-protected wall.
  15. Yeah, that's interesting. From what I've read, the problem wasn't in the MySQL database but in the site design. In other words, it was probably poor coding. It just takes one mistake and a large group of people trying to break the site... A wonderful alternative to MySQL is PostgreSQL, it just doesn't have the PR. I tried to get Peachpit to do a PostgreSQL book years ago. It had feature then that MySQL just recently added. There are also interesting offshoots from MySQL to watch, such as MariaDB. Basically the key creators of MySQL have left Oracle (if they were ever there) and are trying to create their own fork of MySQL that better adheres to their vision. But the fact of the matter is we're all going to continue using MySQL until there's a really convincing reason not to!
  16. Yes, the fact that you're using a framework makes a huge difference. I wouldn't even know where to begin helping you, as I have no experience with CodeIgniter and therefore don't know how it may be affecting things. At the end of the day, the paths still need to be correct, which is the main issue. But the path you've shown there (the bottom link) isn't even remotely correct. The path should just be ./includes/style.css or an absolute URL to style.css. Also, the reason the stylesheet is referenced in the includes directory (in the book), even though the reference is in the header file, which is also in the includes directory, is that the header file is never directly executed. The header file is included by files in the primary directory, so references to the style sheet have to be relative to the primary directory.
  17. Jonathon and Stuart, you guys rock! Thanks for helping out.
  18. Agreed, agreed. One of the interesting things about Ruby is that the language purposefully emphasizes the time of the developer over the time of the computer (i.e., it's not all about making scripts execute as quickly as possible). It's very, very easy to upgrade to a faster computer or hard drive, but impossible to get the hour back that you spent figuring out that '' is 0.26% faster than "". (Not you, of course, but them.)
  19. Thanks! When the third edition of the book comes out, just send me an email and remind me of this conversation. If you subscribe to the newsletter, you'll be notified of the book's status that way. To be clear, I don't even have a deal yet for this book, but the publisher is interested. Thanks for trying to credit me through the link, too. Not sure if that'll work, but I appreciate the effort (I'm generally opposed to advertising, but that Amazon widget is just about covering the cost of my hosting).
  20. Just to be clear, HartleySan really is trying to help and I, for one, appreciate that. Simple: use PHP to write the PHP array out as a JavaScript array. Create a JavaScript variable that's a counter. For each click of the button, increment the counter, which allows you to get the next item in the array. Or, the more complex method would be to use the JavaScript counter, but send it to the PHP script, which uses the counter to return the current element. This is more complicated and would only be necessary if the array was very large. Thanks for the purchases of my books! I haven't written about this specific of a thing in any of my current books. I don't think I agree with you here. I tend to provide cryptic answers because I'm extremely busy. If I took the time to provide exhaustive answers to everyone's questions, I'd never be able to do my own paying work. To me, the purpose of a reply is to get the original poster to understand the answer, not to provide an answer that anyone can understand. If the answer is too cryptic for the original poster, it can be expanded. If other people come along and don't understand the answer, or how it all works together, they can ask a question and that question can be answered. But I very much feel that being cryptic is the same as being efficient. I'm also hesitant to complain about free help, but maybe that's just me. Again, I'm going to have to disagree with your theory here. I don't think it's reasonable to suggest that the poor quality of books is why there are so many on a subject. That's just illogical. As a writer, I know for a fact that there are lots of books on subject X (instead of Y) because the publisher thinks there's a market for it. I don't disagree that there are plenty of books out there that aren't great, but every publisher and every writer is trying to create a good book that the reader likes. Now I'm intrigued about this "Larry Ullman" guy! Thanks for the nice words. I very much do care about getting it right, although I would like to think that all writers do. I've always felt, though, that my books work in part because I don't go into a lot of detail, instead focusing on what really matters (whereas I feel like many technical books have too much of the writer trying to show how much they know). I suspect it's fair to say that I support my books more than most writers. In part that's because this is my job, in part because I learn a lot by supporting the books (i.e., it makes me a better writer), and in part because there is a marketing aspect there. Absolutely what the forum is for! Indeed. And thanks for being judicious in not using them all! One of the things I meant to do was cut down on the bells and whistles, but I haven't gotten to it yet.
  21. Yeah, that's not really the solution or what I meant. In fact, it's not a solution at all. What you did is created those variables (and gave two of them inappropriate values). What you should do is print out what values the variables have. That should be determined by code earlier in the scripot.
  22. Hey Paul, Good to hear from you, too. And thanks for the nice words on the forum. Mostly it was a matter of just spending money! I need to figure some stuff out now (like how to get it to show the forum list after posting a message) but I think this is on the right path. This forum also has the ability to "credit" people (give them points for helping). I don't know how much other people care, but I thought it'd be nice if there was some sort of recognition. Speaking of which, I've never created other moderators before. Is that something that you (and the same goes to you, Floydian) would be interested in? Basically, I like the idea of acknowledging those people that are extremely helpful, but I've always been hesitant to add "moderator" status to others because I don't want you to feel obligated to help out here. Any thoughts are welcome. Hope you're doing well!
  23. Thanks, Jonathon, for sharing that. I'll look at it in detail later. As for the _once() functions, someone just posted on my blog a link to a benchmark suggesting that _once() is actually faster, which makes no sense. The problem with benchmarks, and there are many, is that there are so many factors that can skew the numbers. So what is generally true is not specifically true and vice versa. And, yes, Lerdorf says not to use them, which is a strong opinion. Personally, I like to emphasize best practices over benchmarks. Like: if there's no reason to think a file might be included multiple times, there's no reason to use _once(). Or: if there are no variables to be extrapolated in a string, there's no reason to use double quotes (whether or not that's also 0.26% faster). Some people also unduly stress the importance of speed. If constants are slower than variables (as that link suggests), I'd still rather see constants for some things as it's better programming. My two cents on the subject...
×
×
  • Create New...