Page 1 of 1

php echo problem

Posted: 2020-05-10 07:32
by fciprian
Hello. i have a problem and i do not know what i am doing wrong...
Here is my code :

$disp = array();
$disp_fields = get_sql_fields('Reg_Fin_Z');
$disp_from = get_sql_from('Reg_Fin_Z');
$res = sql("SELECT Date FROM Reg_Fin_Z ORDER by `Date` DESC LIMIT 0, 1", $eo);
while($row = db_fetch_assoc($res)){
$disp[] = $row[Data];
}

So, when i try with : <?php echo json_encode($incasari, JSON_PRETTY_PRINT);?> it shows me the corect last Date but like this : [ "2020-05-08" ]
and when i try <?php echo $incasari; ?> it shows me the word Array

I need to have display the date but in simple way without [ and " . Like this : 08-05-2020.
What i am doing wrong ?

Thank you

Re: php echo problem

Posted: 2020-05-10 17:03
by fciprian
sorry , when i try <?php echo json_encode($disp, JSON_PRETTY_PRINT);?> it shows me the corect last Date but like this : [ "2020-05-08" ]
and when i try <?php echo $disp; ?> it shows me the word Array

I copied wrong.

Please help me.
Thank you

Re: php echo problem

Posted: 2020-05-10 17:39
by jsetzer
Maybe this could help:

Code: Select all

$sql = "SELECT 
  date_format(`Date`, "%Y-%m-%d") 
  FROM Reg_Fin_Z 
  ORDER by `Date` DESC 
  LIMIT 1";
$my_date = sqlValue($sql);
echo $my_date;