0

I have some script that worked before, and now I'm getting some errors. Somebody can help me find the mistake?

while ($value = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
                 
$m = $value['d'];
$o = new ReflectionObject($m);
$p = $o->getProperty('date');
echo "<tr>";
echo "<td>";
if ($value['BsDocEntry']) {
    $id = $value['BsDocEntry'];
    if (strtotime($value['d']->date) > strtotime('01.01.2016')) {
        $id += 383;

    }
} else {
    $id = $value['BaseEntry'];
    if (strtotime($value['d']->date) > strtotime('01.01.2016')) {
        $id += 138;

    }
}
echo $id;

and the error is:

PHP Fatal error:  Uncaught ReflectionException: Property date does not exist in C:\inetpub\wwwroot\serialtest.php:164

Stack trace:
#0 C:\inetpub\wwwroot\serialtest.php(164): ReflectionClass->getProperty('date')

#1 {main}
  thrown in C:\inetpub\wwwroot\serialtest.php on line 164
Dharman
  • 30,962
  • 25
  • 85
  • 135
Roma Meir
  • 9
  • 1
  • What does `var_dump($m)` yield? – Jacob Mulquin Apr 17 '22 at 07:43
  • If you are not a programmer then you should find someone who is and pay them to fix the issue. Even if we give you a solution, how will you implement it if you don't program yourself? – Dharman Apr 17 '22 at 12:39
  • Mistake: Unchecked precondition. Details: See the error message. Furhter pointers: https://www.php.net/manual/en/language.operators.type.php and https://www.php.net/manual/en/reflectionclass.hasproperty.php – hakre Apr 17 '22 at 12:59

0 Answers0