$sqlCek = "SELECT nomor FROM otoritas.permintaan_aplikasi WHERE tanggal LIKE '".date("Y-m-")."%' ORDER BY idpermintaan_aplikasi DESC LIMIT 0,1";
$queryCek = mysqli_query($koneksi,$sqlCek)or die("error");
echo $sqlCek."<br>";
$no = 1;
if(mysqli_fetch_array($queryCek)>0){
$rowCek = mysqli_fetch_array($queryCek);
echo var_dump($rowCek)."<br>";
$no = ltrim(substr($rowCek['nomor'],7),"0") + 1;
}
When I tried to compile the mysql code in PHP code, it didn't show errors (even when i use try and catch exception). So when I tried to search the problem, I found that there is null result when I use echo var_dump (in line 8). When I tried to print the sql variable (line 1 and line 3), it shows SELECT nomor FROM otoritas.permintaan_aplikasi WHERE tanggal LIKE '2022-08-%' ORDER BY idpermintaan_aplikasi DESC LIMIT 0,1
. I copy the sql variable on phpmyadmin, the result returns 1 row (Showing rows 0 - 0 (1 total, Query took 0.0006 seconds.)) which it makes me confused on different result on PHP and phpmyadmin.
So, what should I do to solve this and why is it returns NULL? I tried to look for many another similar problem but it didn't help me.
PS : PHP version is 8.1.2