hi guys..
pls help me out..

in my project , i am extracting the data from mysql database..
and presenting it in a table..

each time a new data is getting displayed row wise..dynamically..
how can i make that data to be get displayed column wise..

fr eg : i m getting it like .. item 1
item 2
item 3
.
item n
but i want it to be ... item 1 item 1 item 2 ... item n

Recommended Answers

All 2 Replies

put your array data into a <table> <tr> instead of <table> <td> . then it display in a column.

put your array data into a <table> <tr> instead of <table> <td> . then it display in a column.

After you have done your select query, if it is multiple records with a single field you are returning, you can use a while loop to display the data retrieved, putting each piece of data into a <td> data </td>

example:

<table width="500">
  <tr>

<?php
while($return=mysql_fetch_array($sql)){
$data=$return[0];
print "<td>".$data."</td>";
}

  </tr>
</table>

I think that should work... didn't test it though.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.