Jump to content
Larry Ullman's Book Forums

hassan

Members
  • Posts

    45
  • Joined

  • Last visited

Posts posted by hassan

  1. 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.

     

     

  2. 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 

  3. 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 ... 

  4. 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
     
     
  5. 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...