So i want to get one and only the first value from a date column in my database, and put it in my PHP file, this is the snippet of the code to get the date:
$one = 1;
$Lihat="SELECT * FROM event where status = '$one'";
$Tampil = mysqli_query($db, $Lihat);
while ( $hasil = mysqli_fetch_array ($Tampil)) {
$query_start_date = "SELECT tgl_event
FROM jadwal_acara
WHERE id_event = '$id_event' AND status = $one
ORDER BY tgl_event ASC
LIMIT 1";
$result = mysqli_query($db, $query_start_date);
$start_date = mysqli_fetch_field($result);
<td class="tgl_mulai"><?php echo date('d-m-Y', strtotime($start_date));?></td>
The problem is that when i tried to echo it in my table row:
It returns an error that said:
strtotime() expects parameter 1 to be string, object given.
Does anyone know how to change it into a string or another method to get the desired display result? Thank you.
EDIT:
$start_date = var_dump($start_date); returns a NULL value when i tested it.
Notice: Undefined property: stdClass::$tgl_event in NULL
But i got other rows that displayed the correct name and event ID, it's just the date that won't display correctly.
it now displays :01-01-1970