how correctly get country and other info from sql

2019-03-04 14:32发布

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;  
    }
    } 
?>

0条回答
登录 后发表回答