I have a table in and MSSQL DB that list period and week start dates for any date in a financial year but the page is only display the week numbers and period number none of the dates does any body have any ideas please.

<?php

  $serverName = 'DESKTOP-R7RU80H\SQLEXPRESS';
  $connectionInfo=array('Database'=>'WebPortal', 'UID'=>'WebAdmin', 'PWD'=>'P455w0rd');

  $conn = sqlsrv_connect($serverName, $connectionInfo);

    if ($conn ) {
      /*
        echo "Connection established.";
      */
    }else{
      echo "Connection could not be established.";
      die( print_r( sqlsrv_errors(), true));
    }

    echo $Today = date("Y-m-d");
    echo "</br> </br>";

  $sql = "SELECT * FROM Calendar_Data WHERE Date = '$Today'";

  $result = sqlsrv_query($conn, $sql);

  while($rowvar = sqlsrv_fetch_array($result)) 
    {
      $Financial_Year = ($rowvar['Financial_Year']);
      $Period = ($rowvar['Period']);
      $Week = ($rowvar['Week']);
      $FY_Start_Date = ($row['FY_Start_Date']);
      $FY_End_Date = ($row['FY_End_Date']);
      $Week_Start_Date = ($row['Week_Start_Date']);
      $Week_End_Date = ($row['Week_End_Date']);
      $Period_Start_Date = ($row['Period_Start_Date']);
      $Period_End_Date = ($row['Period_End_Date']);
    }

echo $rowvar;

  echo "Today's Date is ";
  echo $Today;
  echo "</br> </br>This Week's Start Date is ";
  echo $Week_Start_Date;
  echo "</br> </br>This Period's Start Date is ";
  echo $Period_End_Date;

?>

Recommended Answers

What does the data in your database look like? Line 20 of your code is retrieving all the data within the row(s) of the Calendar_Data table for today's date.

Jump to Post

All 2 Replies

What does the data in your database look like? Line 20 of your code is retrieving all the data within the row(s) of the Calendar_Data table for today's date.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.