-->

how correctly get country and other info from sql

2019-03-04 15:02发布

问题:

I am trying to get country and other info from sql for specific id, only "id" displays correctly in both cases.

<?php
    $sql = "SELECT * FROM `list`  ORDER BY category ASC";
    $result = mysql_query($sql);
    $rows = mysql_fetch_assoc($result);      
    $id = $_GET['id'];
    $country = $_GET['country'];

    echo $id;
    echo $country;  
?>

and

<?php
    $sql = "SELECT * FROM `list`  ORDER BY category ASC";
    $result = mysql_query($sql);
    $id = $_GET['id'];
    $country = $_GET['country'];

    if (mysql_num_rows($result) > 0) {
    while($rows = mysql_fetch_assoc($result)) {

    echo $id;
    echo $country;  
    }
    } 
?>