当前位置: 动力学知识库 > 问答 > 编程问答 >

php - Not able to extract all values of a column in mysql

问题描述:

I am having problem extracting values from a mysql table:

I need to get all values of picname column from a table where uid condition is satisfied.

Now i have two rows where this condition is satisfied but i am getting output only for 1st case. I am not able to get the second row's value. 1st rows value repeats again for second time.

$i = 0;

for($i;$i<2;$i++)

{

$s = "SELECT picname FROM uploaded_data WHERE uid='$uid'";

$que = mysql_query($s,$db);

while($num = mysql_fetch_array($que))

{

echo $name ['picname'];

}

}

Thank You

网友答案:

it should not give you any result you do not have

$name

should be:

$i = 0;
for($i;$i<2;$i++)
{
    $s = "SELECT picname FROM uploaded_data WHERE uid='$uid'";
    $que = mysql_query($s,$db);
    while($num = mysql_fetch_array($que))
    {

    echo $num['picname'];

    }
   mysql_free_result($que);

}
分享给朋友:
您可能感兴趣的文章:
随机阅读: