我正在尝试从表中获取3个数据并出现此错误,第19行是$ ruang2
可恢复的致命错误:mysqli_result类的对象不能为 转换成字符串 第19行的C:\ xampp \ htdocs \ SIL \ HTML \ calender2 \ pinjamruang.php
$ruang=mysqli_query($con,"select * from t_peminjaman_ruang where id_ruang=$ruang and waktu_pinjam=$tanggal and id_sesi=$_POST[sesi1]");
$ruang2=mysqli_query($con,"select * from t_peminjaman_ruang where id_ruang=$ruang and waktu_pinjam=$tanggal and id_sesi=$_POST[sesi2]");
$ruang3=mysqli_query($con,"select * from t_peminjaman_ruang where id_ruang=$ruang and waktu_pinjam=$tanggal and id_sesi=$_POST[sesi3]");
答案 0 :(得分:0)
尝试添加引号,如下所示
$ruang=mysqli_query($con,"select * from t_peminjaman_ruang where id_ruang='".$ruang."' and waktu_pinjam='".$tanggal."' and id_sesi='".$_POST[sesi1].'");