Jump to content

Help with unknown query output


Darkmatter5

Recommended Posts

Here's my table data

Folders

fol_name

cabinet_id

Stocks

4

Telephone

2

Water and Electric

2

Credit Card statement

2

 

Here's the query and code:

<?php
  $query="SELECT fol_name
    FROM folders
    WHERE cabinet_id=2
    ORDER BY fol_name ASC";
  $result=mysql_query($query) or die($query. '<br >' .mysql_error());
  $row=mysql_fetch_array($result);
  while($row=mysql_fetch_array($result)) {
    echo "$row[fol_name]<br>";
  }
?>

 

Now if I run the query in PHPMyAdmin it'll give me this:

fol_name

Credit Card statement

Telephone

Water and Electric

 

If the code is from on my site it outputs this:

 

Telephone

Water and Electric

 

Where's Credit Card statement??

Link to comment
https://forums.phpfreaks.com/topic/130448-help-with-unknown-query-output/
Share on other sites

Try something like this.

 

<?php
  $query="SELECT *
    FROM folders
    WHERE cabinet_id=2
    ORDER BY fol_name ASC";
  $result=mysql_query($query) or die($query. '<br >' .mysql_error());
  $row=mysql_fetch_array($result);
  while($row=mysql_fetch_array($result)) {
    echo "$row[fol_name]<br>";
    echo "$row[stocks]<br>";
    echo "$row[Telephone]<br>";
    echo "$row[Credit Card statement]<br>";
    echo "$row[Water and Electric]<br>";
  }
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.