简体   繁体   中英

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 result 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM