php echo problem

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
fciprian
Veteran Member
Posts: 53
Joined: 2020-04-20 10:51

php echo problem

Post by fciprian » 2020-05-10 07:32

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

fciprian
Veteran Member
Posts: 53
Joined: 2020-04-20 10:51

Re: php echo problem

Post by fciprian » 2020-05-10 17:03

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

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1944
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: php echo problem

Post by jsetzer » 2020-05-10 17:39

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;
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 25.10 + all AppGini Helper tools

Post Reply