0
votes

I have a php throwing this error : Notice: A non well formed numeric value encountered

if ($is_admin_for_product) {
  echo "<tr valign='Bottom'><td NOWRAP><p><a href='../download.php?run=fun&var=" . 
    basename( $stat['name'] ) . "&id=" . $KBID . "'>" . 
    basename( $stat['name'] ) . 
    "</a></p></td><td width='1%' align='right' NOWRAP><p>" . 
    date('M d, Y',$fileinfo[9] . "</p></td>");
} else {
  echo "<tr valign='Top'><td NOWRAP><p><a href='../download.php?run=fun&var=" . 
    basename( $stat['name'] ) . "&id=" . $KBID . "'>" . 
    basename( $stat['name'] ) . 
    "</a></p></td><td width='1%' align='right' NOWRAP><p>" .
    date('M d, Y',$fileinfo[9] . "</p></td>");
}

I saw previous questions but could not understand the solution to this.

1
$fileinfo[9] is most likely not a timestamp. Please provide the output of print_r($fileinfo);ʰᵈˑ
it is an array with name of all files uploaded, say 2 files :hello.jpg and welcome.jpg are uploaded, then the content of $fileinfo[0]=hello.jpg and $$fileinfo[1]=welcome.jpgHello Man
...so $fileinfo[9] isn't a valid timestamp.ʰᵈˑ
Please edit code with appropriate line breaks to remove extreme horizontal scrolling.Terry Jan Reedy

1 Answers

0
votes

This works for me :

if ($is_admin_for_product)
{
echo "<tr valign='Bottom'><td NOWRAP><p><a href='../download.php?run=fun&var=".basename( $stat['name'] )."&id=".$KBID."'>".basename( $stat['name'] )."</a></p></td><td width='1%' align='right' NOWRAP><p>".date('M d, Y')."</p></td>";
}
else
{
echo "<tr valign='Top'><td NOWRAP><p><a href='../download.php?run=fun&var=".basename( $stat['name'] )."&id=".$KBID."'>".basename( $stat['name'] )."</a></p></td><td width='1%' align='right' NOWRAP><p>".date('M d, Y')."</p></td>";
}