Jump to content

boompa

Members
  • Posts

    305
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by boompa

  1. You need to learn how to read errors and warnings, as these are perfectly clear:

     

     

     

    Warning: getProperty2() expects exactly 1 parameter, 0 given in /in/k390G on line 33

     

    Why is the getProperty2 method setup to take an argument? It looks like you copy/pasted the function for setProperty2() and forgot to remove the argument.

    • Like 1
  2. You will make your mailing life easier if you take the time to learn how to use a third-party mailing library like PHPmailer or Swiftmailer and take advantage of them.

  3. Good for you for moving to PDO. Now, read the manual page for PDO's query() method. Note the following in in the Return Values section"

     

     

    PDO::query() returns a PDOStatement object, or FALSE on failure.

    .

     

     

    You do not account for the fact that your query can fail before you go trying to use it in your foreach loop. I note also that you can't necessary be blamed for this, because the example provided in the documentation does the same. Better would be something like the following, at least until you're sure you've got the query right:

     

    $result = $pdo->query();
    if ($result === false) {
        die(print_r($pdo->errorInfo()));
    }
     
    // Successful query
    foreach($result as $row) {
        // Do your output
    }

  4. Perhaps this will help you:

    <?php
    
    $xml = simplexml_load_file('radio.xml');
    print("Day: {$xml->DayData->Date}\n");
    
    foreach($xml->DayData->Rotation as $rotation)
    {
        print("\tRotation Time: {$rotation->Time}\n");
        foreach($rotation->SpotData as $spot)
        {
            print("\t\tTitle: {$spot->SpotTitle} Length: {$spot->Length}\n");
        }
    }

    Running this code on the command line results in:

    php -f radio.php
    Day: 2015-05-11
        Rotation Time:  6a -  7p
            Title: Biore Length: 30
            Title: Motel 6 Length: 30
        Rotation Time:  6a -  7p
            Title: Biore Length: 30
            Title: Motel 6 Length: 30
        Rotation Time:  6a -  7p
            Title: Sprint/Boost Promotional Offer Length: 60
  5.  

     

    Just for a point of reference, if I replace the == with = throughout this whole bit of code, it puts the "NEW" message next to every discussion in the list.

     

    That would seem to indicate that the problem is the $memberid variable is not matching the result members you're testing.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.