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

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.

It looks like you marked this question as solved. Were you able to figure it out?

Be a part of the DaniWeb community

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