Jump to content
Larry Ullman's Book Forums

rob

Members
  • Posts

    143
  • Joined

  • Last visited

  • Days Won

    16

Everything posted by rob

  1. Yeah, thanks margaux good share, learn something new everyday.
  2. The PHP versions are not a factor, get used to checking the online PHP documentation http://php.net/manua...ion.require.php What debugging steps did you take? Did you: check the path to the mysqli_connect.php file? Check that you'd entered the path in require correctly? Get any sort of error message? Have error reporting on? What query were you trying to run? Did you print or log the query so you could check it was what you're expecting it to be? Have you checked the database table structure is correct? Did you check this query directly on the database (via either the command line or an application like PHPMyAdmin). It really sounds like you need re-read chapter 8 in the book, specifically SQL and MySQL debugging techniques.
  3. Contents page XV 'The book uses version 5.3.2 of PHP... ' So, you'll have to check the online documentation for differences between the versions and make the necessary changes to any code that relies on PHP 5.3.2 for it to work in an earlier version.
  4. Max value for specifying type i (for mysqli_stmt_bind_param) is 2147483647. You're not using the code in the book, you've replaced the stored procedures with your own database queries.
  5. I think you've hit a system maximum for INT (2147483647). I'm going to hazard a guess and say your INT field is set to signed and that you're on a 32 bit system? Change the field to BIGINT instead of INT and let me know if that works.
  6. You should really start by following normal query debugging steps: manually write out and execute the SQL directly on the MySQL database and see what happens. [edit] I've assumed that you've checked both the values used and the generated query to ensure it is what you're expecting in your code. Also are you making sure your $phone value is an integer before passing it to the query?
  7. Yeah, you can pass NOW() into the prepared statement as a non-bound parameter. For the password, I would make this bound and assign the result of get_password_hash to a variable, adding it via mysqli_stmt_bind_param.
  8. You're placing values in the prepared statement, remove these and replace with parameter markers. Remove the single quotes around your variables where you're binding the parameter markers to your application variables. Ensure you have the same number of application variables for the number of parameter markers.
  9. If you're not able to provide the basics of how you're setting and retrieving your quantity $_GET variable, I doubt anyone will be able to help you without just rewriting the code for you, I can't help you any further.
  10. That's not really helpful, Kerry; I don't see any $_GET variable that resembles anything that would be used for a user set quantity for a product. What code are you using to send the quantity to the cart script? (please do not just repost the whole script) i.e. just the part which actually sets the $_GET variable for the quantity. Sorry if this sounds harsh, but do you know the basics of PHP and in particular how to set and retrieve a $_GET variable? Because your answers seem to indicate you don't. If you're not able to do this, your best bet is to get following book http://www.amazon.co...s=9780321784070, learn the basics then come back to this book (which assumes PHP knowledge) and have another go.
  11. Can you post the code you are using to set the quantity in the session. If you're setting this quantity in $_SESSION in the cart script, can you also post the code which you are using to send the quantity to the cart script.
  12. Which quantity are you talking about? The quantity set by the customer or the stock quantity? I'm asking because the second code sample you've provided seems to indicate you're talking about stock quantities. If it's the quantity set by a customer (i.e. add to cart) how are you passing that quantity to the cart script and how are you accessing that quantity in the cart script? If it's the stock quantity, what debugging steps have you taken to ensure that the quantity is being successfully retrieved from the database?
  13. You're missing a closing select tag. If you want the quantities accessible in the cart script, you'll have to construct (for each quantity) a link including the quantity to your cart script and retrieve it using the usual $_GET syntax.
  14. You need to remove the styling you've put in your code above, it's messed up. Did you run this code?
  15. No and yes. There's no way to check via php on your server. However, there is a hack involving referencing an image via a proxy script, which can work; but, I (and I assume a proportion of other users on the internet) have set my email client not to show images automatically for emails sent by people not on my contacts list.
  16. You may want to have a look at http://www.sitepoint...eebbc5f1a378970 Sitepoint let you download sample chapters to review before purchase and I've always found they send a discount offer via email within about 24-48 hours of downloading a sample. Don't be afraid to look online. I just googled and found what looks like a reasonable free screencast series at: http://learncss.tutsplus.com/ Personally, I learnt the basics from Dan Cederholm's books, but for html5 used the Sitepoint book http://www.sitepoint...books/htmlcss1/ which I can highly recommend.
  17. I would advise, store the name of the file in the database and not the file itself. On upload, generate a separate file for the thumbnail, which you reference via the code e.g. original_filename.jpg and generate original_filanme_tbn.jpg. Then on thumbnail gallery pages reference the original file name from the database with whatever you use as a designator for the thumbnail image. Generating the thumbnail images during a page request by the user is a really bad idea; you're ultimately penalising the user in terms of time, you should really address thumbnail creation at the point of uploading the original image.
  18. I really think that if you're asking for such sensitive information, you have an obligation to offer the right level of security, SSL for form submissions. I also really hope that you haven't started accepting this information via email without checking that it's secure. My comments might come accross as harsh, but if you were asked for your passport number, social security number with your name and address, would you be happy to supply them if you didn't see a secure connection or some sort of notice saying that emails were secure? An identity fraudster would have a field day with this information. Jonathon's comment about shared SSL is probably the most sensible and cheapest approach.
  19. It does affect something it affects the source code layout, which is the whole point of using it, to make source code more readable.
  20. Undefined variable only means one thing, I'd re-check your syntax to make sure a value is being assigned to $e. Why are you querying the database to retrieve the email address which you already know and are using to construct the query? Why not just assign $e to the session variable? If you don't find where the error is, you'll need to post more code for people to be able to help.
  21. So, what debugging steps have you taken? Undefined offset and Warning: Invalid argument supplied for foreach() are pretty standard errors for someone with php experience.
  22. You need to put some entries in the database.
  23. 2nd tip page 154 in the book: there's a script provided by Larry in the downloadable code if you're not sure how.
×
×
  • Create New...