开发者

Displaying Values of MYSQL Result via PHP

OK, this is an amateur question but I am having the most trouble displaying the values of my database. I want to display the entire 'phone' column so my mysql query is this:

$result = mysql_query('SELECT phone FROM contactList WHERE phone != 1') or die(mysql_error());
$row = mysql_fetch_array($result)

My PHP script is as this:

while(isset($rows))
{
echo $rows['phone'] . "html break tag";
}

It looks like though I'm only getting the first re开发者_如何学编程sult instead of looping through the entire column.

Do I need to increment the ID in my loop and get value via ID? The only problem with that is my auto-incremental ID column starts @ 130 and skips some numbers here and there.


try this instead

While($row = mysql_fetch_array($result))
  echo $row['phone'];

That should help you looping through the whole array.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜