0
<?php   //sql query which gets the data from database
$query = mysql_query ( "SELECT aaa,bbb,ccc,ddd,eee FROM xyz"); 
$row = mysql_fetch_row ($query);
?>

This query returns a 2-D array how to display that. This returns a part of table.

1 Answer 1

1
echo $row[0];
echo $row[1];
echo $row[2];
echo $row[3];
echo $row[4];

that's it. Or you can print_r whole array

print_r($row);

but to show all 5 lines you have in your DB, you should do it like

<?php 
$query = mysql_query ( "SELECT aaa,bbb,ccc,ddd,eee FROM xyz"); 
while($row = mysql_fetch_row ($query)){
         echo $row[0];
         echo $row[1];
         echo $row[2];
         echo $row[3];
         echo $row[4];
}
?>
Sign up to request clarification or add additional context in comments.

7 Comments

there are several values of aaa,bbb,ccc
+1 for going to suggest print_r() you're ahead of me all day! leave some to me!! :P
@RikudoSennin: Lol. You're my enemy. I did 10k in 2 months. I can't allow you to be faster!!! (:p)
it returns 5 rows and 5 columns
:DD Actually I'm really taking my time here, but now that you said it, I MUST BE FASTER!! MADARA TIME SLOW ATTACK! </insanity>
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.