Jump to content
Larry Ullman's Book Forums

hassan

Members
  • Posts

    45
  • Joined

  • Last visited

Everything posted by hassan

  1. Hi In Chapter 1 it discusses variable and constants. Why would you not simply assign a value to a variable and then not change it as opposed to defining a constant? or is there other benefits by defining constants?
  2. Many thanks I think I get what you mean that would be a level above operating at the raw database level.
  3. Hi On page 645 the second tip mentions the DROP command and the REVOKE command. Would I be correct in assuming that: 1) We will use a DROP command for example if users wished to complete remove/close his or her account. 2) We will use REVOKE command for example when a users subscription ends so that we may remove read access to some paid for information
  4. apologies, I was missing out -u root -p when connecting to the MySQL client
  5. Hi I have tried to change the root password of MySQL after a fresh installation but have not been successful. I probably am missing something, but I have been following the installation instructions as given in the appendix. I also looked at Chapter 4 as well but I am not having any luck. I get the following output: MariaDB [(none)]> set password for 'root'@' localhost' = password('test123'); ERROR 1131 (42000): You are using MariaDB as an anonymous user and anonymous users are not allowed to modify user settings MariaDB [(none)]> I don't understand how I have become anonymous user and how do I change that.
  6. Hi Larry Thanks for the reply. I got the fourth edition and I actually ordered and received the fifth edition last week. Hassan
  7. Hi I think I have 4th edition of the book that has the shopping cart example. I want to learn PHP7 so I was thinking of obtaining the new version of the books. I wanted to know if the old shopping cart example will work? and is it compatible with PHP7? Also was there any reason for not including the shopping cart example in the 5th edition? many thanks .. Hassan
  8. Hi I wanted to ask will there be a new version of this book using object oriented code and php 7? Also to make the code php7 are there major areas of code that need to be re-written? Thanks in advance.. Hassan
  9. Thank again Sorry for asking too many questions ... I am enjoying it ... I started learning a while ago then stopped and now started again this time not to quit ... I realised alot of things I simply glossed over ... or didt type out all the code nor experimented much with the code ... this time round I am doing that and its alot more fun and I am enjoying it ... I think by being curious and trying out different things giving me more confidence to write my own little snippets ...
  10. Thanks I was just experimenting with the different commands didnt quite realise what it does ...
  11. Ok so for example I could read a CSV file and put that in an array and may then later store that array into a database?
  12. Ok thinking a bit more about it ... would we use the for loop for example when we want to display ten items from a data base and create mulitple pages showing ten items? like in a product catalog?
  13. Hi I wanted to ask why in chapter three the content div is split between the header and footer. Why do we not simply write that div in the content chunk of the php page? Thanks in advance
  14. Hi On page 70 it discusses loops and states "The functionality of both loops is similar enough that for and while can often be used interchangeably. Still, experience will reveal that the for loop is a better choice for doing something a known number of times, whereas while is used when a condition will be true an unknown number of times." I understand that the foreach loop will get everything in an array. Where and when and why would you use a for loop instead of a while and vice-versa? (can someone give practical scenarios)? Also where and when and why would you use a do while loop? what benefits does it have instead of using foreach or for or while loops? Thanks in advance
  15. Hi I used shuffle() and it seems to get rid of the titles of the movies I see the below: Sorted by shuffle order rating: 10 0 2 1 9 2 7 3 5 4 10 5
  16. Hi on page 65 it mentions hows strings can be converted to arrays and arrays into strings. When would one use that in a real world programming situation? Thanks in advance :-)
  17. Hi In the book on page 57 it states in the tips "Because PHP is lax with its variable structures, an array can even use a combination of numbers and strings as its keys. The only important rule is that the keys of an array must each be unique." How can you get duplicate keys? I tried experimenting wrote the following: <?php echo "<p>This text was generated by PHP!</p>"; echo "hello word<br>"; $states['IL'] = "hellow"; $states['IM'] = "IM hellow"; $states['IM'] = "IM hellow2"; echo $states['IL']; echo "<br>"; echo $states['IM']; echo "<br>"; echo "Test this: {$states['IM']}"; ?> It simply assigns the new value to the array and not let me create a duplicate?
×
×
  • Create New...