• 7
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

In my database I have set row "posted" as a timestamp but I get this notice when trying to convert/format it:

Notice: A non well formed numeric value encountered

code:

$posted = date('d/m/Y H:i:s', $row['posted']);
    echo $posted;

what am I doing wrong?

      • 2
    • It just calls the timestamp row, this is first time playing with timestamp option usually I just set it to varchar and update it with the date, I'm guessing I need to add more then?
    • The second parameter to date() needs to be a unix timestamp, so if the data in the posted column is not a timestamp, you have to convert it to one first. I'm guessing it is in yyyy-mm-dd hh:mm:ss format which means you have to use strtotime first.
      • 1
    • Thanks drew010, sorry I don't seem to have the +1 option to mark your answer, not sure if its a privilege thing or not.
    • What does var_dump($row['posted']); show? Maybe you need to call strtotime() on $row['posted'] first?

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags

Related Questions