how correctly get country and other info from sql for specific id

不羁的心 提交于 2019-12-02 18:48:17

问题


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

来源:https://stackoverflow.com/questions/33308833/how-correctly-get-country-and-other-info-from-sql-for-specific-id

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!