Postingan lainnya
Mengatasi eror warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in
include "../../config/server.php"; $host_name = gethostbyaddr($_SERVER['REMOTE_ADDR']); //untuk mendeteksi computer name
$pc_client = $host_name; $status_server = 0; $status_internet = "Jaringan server ke Internet : Terhubung";
// Penambahan SQL Statistik - 2017/03/09 $jumkelas = mysql_num_rows(mysql_query("select * from cbt_kelas")); $jumsiswa = mysql_num_rows(mysql_query("select * from cbt_siswa")); $jummapel = mysql_num_rows(mysql_query("select * from cbt_mapel")); $jumsoal = mysql_num_rows(mysql_query("select * from cbt_paketsoal")); $jumsek = mysql_num_rows(mysql_query("select * from server_sekolah")); $jummedia = mysql_num_rows(mysql_query("select * from cbt_upload_file")); ?>
SERVER PUSAT
Server ID :
Tanggapan
file koneksi ke database coba copas ke forum sini
1 Jawaban:
Arti errornya fungsi mysql_num_rows() butuh paramter "koneksi" bukan boolean, yang kamu masukkan diatas adalah boolean "mysql_num_rows(mysql_query("select * from cbt_kelas"));" lihat contoh penggunannya <a href=' http://php.net/manual/en/function.mysql-num-rows.php '> http://php.net/manual/en/function.mysql-num-rows.php </a> <pre> <?php
$link = mysql_connect("localhost", "mysql_user", "mysql_password"); mysql_select_db("database", $link);
$result = mysql_query("SELECT * FROM table1", $link); $num_rows = mysql_num_rows($result);
echo "$num_rows Rows\n";
</pre>
*btw fungsi mysql.. sudah tidak disarankan untuk dipakai, belajar memakai mysqli atau pdo di PHP, kamu bisa <a href=' https://sekolahkoding.com/track/belajar-php '>belajar kelas php disini</a>