Monday 3 September 2018

can not recover data from mysql db with PHP

I cant retrieve record from mysql database, there's no error messages and nothing showing. The things is I want to retrieve data on a page with session using external php file. My table has data on it, I've inserted it with phpmyadmin. Here's the code :
UPDATE
I only work on php file now, and here the konek.php
<?php
error_reporting(E_ALL);
$konek=new mysqli('localhost','root','zxcvbnm','jumat') or die(mysqli_connect_error);

$selek=mysqli_query($konek,'select * from kategori');
    while($baris=mysqli_fetch_array($selek)){
        echo $baris['kodekat'].' '.$baris['namakat'];
        echo '<br>';
    }

if($konek){
    echo 'koneksi ok';
}

$konek->close();
?>

it only shows the 'koneksi ok' word, is the while not processed?
thank you in advance

What are you trying to do with this line:
if($i<=mysql_fetch_array($selek)){

If you are trying to compare with the no. of data use:
if($i<=mysql_num_rows($selek)){

0 comments:

Post a Comment