Jump to content

Eiolon

Members
  • Posts

    358
  • Joined

  • Last visited

Profile Information

  • Gender
    Male

Eiolon's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

  1. I am working on a calendar but am having difficulty finding a way to loop the events through the concatenation. Having it loop on the outside of the string brings only the first event for the day, not all of them. If I loop outside of the string of $week outputs all the events but it creates a new "day" square for each event. Thanks for your advice. for ($day = 1; $day <= $count_days; $day++, $str++) { $date = $year_month . '-' . $day; $sth_events = $dbh_mysql->prepare(" SELECT id, name, date_time FROM events WHERE date_time LIKE '$date%' "); $sth_events->execute(); while ($row_events = $sth_events->fetch(PDO::FETCH_ASSOC)) { $name = $row_events['name']; } if ($today == $date) { $week .= '<td>' . '<div class="today">' . $day . '</div>' . $name; } else { $week .= '<td>' . '<div class="day">' . $day . '</div>' . $name; } $week .= '</td>';
  2. Thanks for all your advice. I have done all you have suggested. The only error that returns is the Notice: Undefined variable: $LastActivityDate No connection errors reported and the company's database I am connecting to does see the server connect without a problem.
  3. I've been connecting to a database for a number of years now. The MSSQL server was updated the other day and it can no longer pull the data down. I connect with PHP PDO ODBC driver. The connection to the server is good, but nothing is returned. I can throw the query into my SQL client and bring up the data without a problem. Any ideas on what I can try? Here is a sample: <?php $HOSTNAME = '1.1.1.1'; $DATABASE = 'db'; $USERNAME = 'user'; $PASSWORD = 'pass'; try { $dbh = new PDO("odbc:Driver={SQL Server};Server=$HOSTNAME;dbname=$DATABASE", "$USERNAME", "$PASSWORD"); array (PDO::ATTR_PERSISTENT => true); } catch (PDOException $e) { echo $e->getMessage(); } $Barcode = '37782555863'; $sth = $dbh->prepare(" SELECT LastActivityDate FROM Customers WHERE Barcode = :Barcode "); $sth->bindParam(':Barcode', $Barcode); $sth->execute(); while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { $LastActivityDate = $row['LastActivityDate']; } ?> <?php echo $LastActivityDate; ?>
×
×
  • 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.