Jump to content
Larry Ullman's Book Forums

StephenM

Members
  • Posts

    59
  • Joined

  • Last visited

Posts posted by StephenM

  1. I thought HartleySan meant if a user had already registered an account in both tables with the same email address -- so that there would be a match across both tables for email address .

    But I misunderstood, It makes more sense HartleySan wanted to see, before the new account registered, if this email address already existed in either table.

    So as this is the case, I can see now why the INNER JOIN won't work here.

     

    Why can't the same email address be used in both tables. Is it because UNIQUE works across an entire database and not just an individual table?

     

    But to confirm that I understand what I was trying to achieve (erroneously), let's say the same email address was already used to make an account in both tables[if that's possible in MySQL terms], would this INNER JOIN work then?

  2. Hi,

     

    I'm on the MySQL chapters now and I'm getting a bit confused here. :blink:

    I understand the union solution and i can see how it's the best due to it's efficiency.

     

    But just wondered why an inner join like this would not render results for you:

    SELECT t1.column, t2.column FROM table1 as t1
    INNER JOIN table2 as t2 
    ON t1.email = t2.email
    WHERE t1.email = "email-address"
    ;
    
    
    

    ?

     

    All the Best,

    Stephen

  3. Hi Stanley,

     

    Thanks for your answers. Actually, it is a radio and selected input but the checked button doesn't change dynamically when view on the screen but the HTML itself does and the HTML looks right.

     

    When I enter 4, I expect the first radio to be checked. When I enter 6, I expect the second radio to be checked but this does not happen.

     

    About learning:

    Do I enjoy it; YES. [but there are moments after a few hours looking at some silly error, I question that!]

    I really appreciate your insights because that kind of information is tough to come across.

    I started learning HTML & CSS @ end of November. Then I moved to Javascript in January. Now that's when I realized that this stuff is going to take a long time to get right. I'm hoping that in 4 or 5 months I will have covered "PHP and MySQL for Dynamic Web Sites:" and then maybe "Modern Javascript" in a further 4 months.

    Then I suppose I could practice making some fully fledged sites. I have an idea to make my own and one for a family member.

    If you don't mind my asking, were you working full-time on learning web development during those 5 years?

     

    Thanks a lot!,

    Stephen

  4. Thanks for this solution, it works just fine.

    I didn't know a function couldn't be inside an echo statement.

     

    I know this is unrelated but eventhough the correct <input> has checked="checked" --> this doesn't display on the screen as such.

    Do you know why this is, do i need to use javascript or something?

     

    & just way off the point, if this question doesn't bother you, do you know how long it would take to get good at PHP,MySQL & Javascript?

    [like good enough to do it as a proper paid job]

    I work part-time in another field but I can spend around 3 full days per week learning this web development & just started recently enough.

  5. Hi all,

    I bought this book 2 weeks ago and have starting reading it a few days back.

    I am having a problem. I'm doing the review of the 2nd chapter but I modified the tasks a bit and I am in a quagmire with a function inside a function.

     

    The problem is that I want the "checked" to be contained inside the <input checked="checked"> but instead it keeps reverting back to before the entire html output.

     

     

    Relevant PHP

     

    // function to control which radio button will be checked depending on the value entered by user
    function ifstatement1 ($value,$id) {
        if
        (
         ($value < 5.7) && ($id==1) // checked first radio button
         OR
         (($value>5.7) && ($value <6.4)) && ($id==2) // checked second radio button
         OR
         ($value > 6.4 ) && ($id==3) // checked third radio button
         )
        {
            echo "checked";
        }
    }
    // Create radio button function
    function create_radio ($id, $name, $value, $description){
        echo '<p><input type="radio" id="'.$id.'" name="'.$name.'" value="'.$value.'" checked="'. ifstatement1 ($value,$id).'" > '. $description .'</p>';
    }

     

    Any help will be appreciated,

     

    Thanks

×
×
  • Create New...