mysql select query only showing one data in php

wita

so I'm trying to show data from my sql table. There are two data but only one of them shows when I try to open my php page. here's my codes :

<?php
    include ("koneksi.php");

    // $username=$_GET['username'];
    $username="Dia";

    $result = mysql_query("SELECT * FROM tbl_penyakit_user WHERE username='Dia'");
    $row = mysql_fetch_array( $result );

    echo " penyakit: ".$row['penyakit'];

?>

I tried to run the select query on phpmyadmin an it showed 2 data. Thanks in advance

Chris Forrence

mysql_fetch_array only gets one array at a time. To properly get all available rows, put it in a while-loop like so:

while($row = mysql_fetch_array($result)) {
    echo " penyakit: " . $row['penyakit'];
}

As an aside, however, please note that the mysql_* functions are considered deprecated, and should not be used in future development. (Here's why)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Insert DATA into 2 tables using one Query using PHP and Mysql

From Dev

php curl fetch mysql data - returning only one row

From Dev

MYSQL Query not showing data properly

From Dev

PHP Query select one record

From Dev

PHP Mysql select is only showing one row

From Dev

MySQL only showing last data

From Dev

PHP mysql Select query calling more than specified data

From Dev

Query only returning one row (PHP / MYSQL)

From Dev

How to fetch multiple data from mysql database with only one query?

From Dev

Multiple data query and only showing it once

From Dev

MySql query to select one image

From Dev

PHP PDO SELECT query not showing results

From Dev

PHP - basic select query returning only the first row of mysql database

From Dev

PHP Roster only showing one player on click

From Dev

PHP select one data from mysql NOT DISPLAYING

From Dev

PHP Mysql select is only showing one row

From Dev

Mysql Query select one row from the same values (select duplicate only)

From Dev

PHP MySQL Query Select Count

From Dev

Mysql Select Query without PHP

From Dev

MYSQL select query in PHP

From Dev

How to check if one of the query is in the range of data in PHP MySQL?

From Dev

Wordpress query showing only some data

From Dev

MySql query with limit showing one less element

From Dev

php mysql query returns many array but need only one

From Dev

How to select and echo MySQL data (one to many) using PHP

From Dev

error in query using MySQL and PHP, based on showing data from database

From Dev

Php array into mysql select query

From Dev

select query inside in select query php mysql

From Dev

PHP can't select anything from only one of the mysql tables

Related Related

HotTag

Archive