Jump to content
Larry Ullman's Book Forums

HartleySan

Members
  • Posts

    3047
  • Joined

  • Last visited

  • Days Won

    243

Everything posted by HartleySan

  1. I agree with Larry here. I can't imagine any instances where I'd want to send emails but don't already have a domain and web server set up.
  2. No, you're not. The actual characters in the string should be completely irrelevant. The whole point of mysqli_real_escape_string is to escape characters that could potentially harm a DB query. That's it. The actual characters in the string should not cause the function to fail. Are you sure your DB connection and all of that is valid?
  3. Apostrophes in the string are not going to cause mysqli_real_escape_string to break. Something else is going on.
  4. I've never had much luck (I've had some luck) with sending emails from localhost on XAMPP. The following might be worth a try: http://stackoverflow.com/questions/4652566/php-mail-setup-in-xampp
  5. There is overlap between the advanced book and the e-commerce book, but I think the e-commerce book focuses more on online payments, security and advanced MySQL queries, whereas the advanced book focuses more on OOP and advanced stuff in PHP. I personally think that the e-commerce book is more practical, but again, they're all worth reading and good to know about if you're serious about web development.
  6. I agree with abigail. Given your situation, Stripe would be perfect for you, and the 2nd edition of the e-commerce book explains how to use Stripe in detail. PayPal is quickly becoming a thing of the past. I say drop it and go with Stripe.
  7. If one category can have multiple items, and an item will never be in more than one category, then I would have a table to describe all the categories, and then in a separate table that contains all the items, I would have a column for the category ID to act as a foreign key to link the two tables. That make sense?
  8. Hello, and welcome to the forums, hansie. Is your server running? Are you going through localhost in your browser? What errors, if any, are showing up? Have you compared your code to the code in the downloads section? Please give us more information. Thank you.
  9. They're the same, but for the argument you pass to set_charset, you have to use the string 'utf8'; 'utf-8', 'UTF8', etc. will not work.
  10. I think it depends on where you want to go with your learning. If you want a more well-rounded view of the web and making sites, I recommend the JavaScript book. If you want an e-commerce site and want to better understand web security, then I recommend the e-commerce book. And if you want to just be really good at PHP, I recommend the advanced book. Really, they're all worth reading, but I would recommend the JavaScript book first. Also, the Yii book is pretty good, if you want to learn a framework.
  11. I'm not sure why that would mess up mysqli_real_escape_string, but maybe. Please let us know if you figure out what's wrong. Thanks.
  12. The semicolon at the end of the following line is messing things up: JobSkills = \"$JobSkills\"; Change it to a comma, and the error should go away.
  13. MikeMikeMike is an older forum member that had several uncomfortable exchanges with other people on this forum. No one has seen him around for ages though.
  14. In my personal opinion, Flex is becoming less and less useful, like you said. it doesn't hurt to know Flex though, as a lot of the programming concepts found in Flex carry over to other languages (after all, ActionScript and JavaScript are both based on ECMAScript), but I agree with you that your time would be better spent learning JavaScript if your goal is to make yourself relevant and marketable. Still, Flex is an interesting thing to learn as a hobby (and there are still the occasion jobs that float around that ask for Flex devs, which there aren't many of anymore). Hope that helps, and welcome to the forums, kelvin.
  15. Like I said, the $i incrementer is the least ideal option. You're better off rewriting your CSS/HTML to make everything more semantic.
  16. Because your while loop is not set up correctly. Something like the following should get you there: $i = 0; while (something) { if ($i % 4 === 0) { // echo tr start tag. } // echo td tag with img. if ($i % 4 === 0) { // echo tr end tag. } $i++; } Better than that solution though, you could just use CSS to set the td widths to 25%, or even better than that, you could not use a table at all (tables are for tabular data!), and instead used an unordered list or just images that are either floated left or have the inline-block display property. That all make sense?
  17. What errors (if any) are you getting? Have you tried performing the query directly on the DB? Edit: I responded right when you did. Sorry. Nice find.
  18. laurent, I can't really give you any advice because I can't understand your question or your code. Could you please rephrase your question? Thanks.
  19. I'm not sure I understand your question, but it sounds like you're asking what to do when $_POST['tag'] is an array, and not a number. If $_POST['tag'] is an array of numbers, then you can use a for loop or a foreach loop to loop through the array, and run the filter_var function on each of the elements in the array. If the values are strings, then you can easily typecast the values to integers with (int). That answer your question (assuming I even understood it correctly)?
  20. Sounds good. Once you have the PHP and front-end code down, it's always good to try and set up PHP, etc. on your own. Thanks for sharing your experiences.
  21. laurent, there are actually a lot of issues with your code, but in general, it seems like you do not have a fundamental grasp of the difference between strings and arrays, and how they're used. Please do me a favor and start at the beginning of Larry's book and any other basic PHP tutorials you can find to get the basics down. Once you have the basics down, I think the rest will fall into place. Thanks, and sorry if I hurt your feelings/pride at all.
  22. The problem is that you're using the variable $tag for two different purposes. If $tag is an array, then you start to loop through it, and then you add another string element onto the end of the same $tag array, which is incorrect. Furthermore, your approach to doing a multiinsert is incorrect. You have to build up the query string with multiple sets of parentheses. For example: $q = "INSERT INTO pages_tag (page_id, tag_id) VALUES"; if (is_array($tag)) { foreach ($tag as $tag_id) { $q .= " ($page_id, $tag_id)"; } } else { echo 'loupé coco'; } $q .= ";"; echo $q; // This is the actual query string you want. Please note that this code will leave you with an ill-formatted query string when $tag is not an array. You should account for that.
  23. As Antonio said, using a solution that already exists would probably be best. It's not necessarily that hard to do, but it does require a decent amount of JS knowledge, and how to handle cross-browser issues.
  24. There's nothing in Bojangles's answer about why unset is better than array_splice. In fact, there's only one mention of array_splice on the entire page, and that guy links to a detailed explanation of why array_splice is better than unset. Thoughts?
×
×
  • Create New...