Jump to content
Larry Ullman's Book Forums

Larry

Administrators
  • Posts

    5413
  • Joined

  • Last visited

  • Days Won

    155

Everything posted by Larry

  1. Hello Antonio, Thanks for sharing your excellent thoughts. I agree that coming up with a consistent naming scheme is vital, and is true for the columns as well. I generally split by underscore, but when I do OOP, I don't. In non-OOP code I do some_var; in OOP I would do someVar. If the database is going to be interacted with from an OOP perspective, then naming the tables and columns consistent with OOP is better (in my opinion). I prefer to use uppercase for all SQL keywords, too. Just be careful not to put any white space between a MySQL function name and its opening parentheses. Very good tip! Another very good tip. VIEWS have helped me out of a lot of jams. In fact, I'm working on a project now where normalization created four tables that are hard to JOIN and the solution was not to de-normalize but to use a VIEW. Thanks again!
  2. Thanks for the nice words on the book. It is appreciated. So to confirm, are you still having a problem or no?
  3. Hey Bob, As I believe it says on the Web site, and in the SQL file itself, you should not import the entire file as is. This is in part because one stored procedure gets redefined at a later point in the book. My recommendation is to copy and paste the SQL commands as needed as you go through the material.
  4. Hey Lou, Thanks for the feedback and for all the nice words. Very much appreciated. Glad you liked this new edition. A couple of thoughts for you...it is sometimes necessary to use files, so that's important to discuss, I believe. The next edition will probably use the MySQLi extension. I've been holding off for those slow adopters. I start the new edition of the PHP Advanced book in 2012! Thanks again!
  5. Hey Jon, To be clear, I don't actually like to use Zend for an entire Web site. I've tried, and didn't like it. But what I like about Zend is that you can use modules individually and they have some great ones. So I often use a Zend module or two in non-Zend sites, just like you could use PEAR. In fact, I've frequently used Zend modules in a Yii-based site. You might be interested to know I'm writing a book on JavaScript right now.
  6. Thanks for the nice words, Jon. Very much appreciated. I wrote about this in my newsletter some time back, but in some ways, the functionality of PEAR has been replaced by frameworks such as the Zend Framework. And the Zend Framework is also better maintained!
  7. So sorry for the delay. I was traveling for most of July and this got lost in the shuffle. My sincerest apologies. Do you still need help with this? If so, I'll get you a fast reply (let me know if any particulars have changed, though).
  8. What is the URL in the browser when you're seeing that error message?
  9. Sorry for the delayed reply. Been a hectic summer! And thanks for the nice words on the books. Much appreciated. Kudos, too, for including lots of details. This is confusing. That command line step is how you execute the command-line mysql client. It is NOT how you start the database application. Conversely, the System Preferences can be used to start and stop the database application. But these are two different things. On Mac OS X, /tmp and /private/tmp are the same. If you have a mysql.sock file, then MySQL is running. Since it's been a while since the original post (apologies again), why don't you confirm where things stand now and I'll try to get you a fast reply.
  10. Well, the goal is, for a previously selected menu option, to create HTML like YY So the first part of code that you highlight in bold creates the first part of that. The $k comes from the appropriate array: states, months, or years. So $k will have a value like 'AL', 'January', or 2011. The next step is to see if the item currently being added to the the menu was previously selected by the user. That's why $k is compared to $value, $value always being the user's selection or entry for the given input. Does that make sense?
  11. That's a recommendation for the maximum file that can be uploaded in bytes. It's a recommendation that not all browsers will adhere to, but is worth doing. 30000 byes divided by 1024 is a bit more than 29KB.
  12. So I installed Net_GeoIP along with the free GeoLite Country database (http://www.maxmind.com/app/geoip_country). Net_GeoIP works fine, but most of the functionality requires a paid database. So if this is something you want to pursue, it seems like you'll need to buy an IP Geolocation database and then you can use Net_GeoIP. The code for doing that is pretty easy and documented in the PEAR manual. Apologies once more for the big delay!
  13. Okay, so I've just updated PEAR and installed Net_Geo and I'm seeing the same notices you saw. I'm going to look into Net_GeoIP as an alternative.
  14. Thanks for pointing that out. I've added it to the errata page!
  15. So very sorry for the delay. I can normally get quick answers to people quickly and involved answers to people... Thank you for the nice words on the work. I'm tacking a crack at this right now to see what I can figure out. Apologies again for the delay!
  16. My first thought is that I don't understand why these aren't one table. If you have a one-to-one relationship between two tables like you do, why have two tables? But the answer for your situation is that you create the record in the first table, call the mysqli_insert_id() function to get that table's just created primary key, then you can use that value in the second query.
  17. I suspect you should still use auto_increment, but I'm not exactly clear as to what's going on. How about posting the table definitions, or the relevant parts?
  18. Hmmm... I see nothing wrong in the code. Could you post the URL that you're using for accessing the form? And also post the URL that results after submitting the form?
  19. And just to confirm, you are actually entering values into the form elements before submitting the form, yes?
  20. Okay, so that doesn't actually tell anybody anything. HOW did you check? HOW did you know that they were correct? Because if they are correct, then they should work through a PHP script. Is that the *active* configuration file? And if it is, and there is no C:\\Windows\\php.ini, that means there is no active configuration file and you need to put one there.
  21. If I understand you correctly, you'll be fine without that code in there.
  22. Okay, my question is this: are there records for any given latitude and longitude that will have a distance less than 1 mile? When you run the query without the WHERE clause, what are the lowest distance values returned?
  23. That's better, but per the forum guidelines, it'd still be best to always include the versions involved. Most importantly here, no one could answer your question without knowing the database table and columns involved. Okay, if you check out the PHP manual pages for working with stored procedures, you'll see that after executing the statement, you can do this: if (mysqli_stmt_num_rows($stmt) == 1) { Then, within that conditional, to fetch the returned row, you would do this: mysqli_stmt_bind_result($stmt, $username, $user_id); mysqli_stmt_fetch($stmt); Then the $username and $user_id variables have the retrieved values.
×
×
  • Create New...