0

I am trying to display the selected values in columns as table format from the database. I have columns name listingsdbelements_field_name and listingsdbelements_field_value in the database , i am extracting the data like this

$sql1 = "select listingsdb.listingsdb_id,  listingsdb.listingsdb_title, listingsdbelements.listingsdbelements_field_name, listingsdbelements. listingsdbelements_field_value from listingsdb,listingsdbelements where listingsdb.listingsdb_id IN (" . implode(',',$name) . ") AND listingsdb.listingsdb_id = listingsdbelements.listingsdb_id "; 

$result = mysql_query($sql1) or die (mysql_error());



while ($row = mysql_fetch_assoc($result)) {

echo $row['listingsdbelements_field_value'];

echo $row['listingsdbelements_field_name'];
}

I want to display it as

<tr><td>Field</td><td>Values</td></tr>

Under Filed i want to display listingsdbelements_field_name Under Values i want to display listingsdbelements_field_value

Can somebody suggest me how to achieve this?

4

1 回答 1

1

如果我正确理解了这个问题:

while ($row = mysql_fetch_assoc($result)) {

    echo "<tr">;
    echo "<td>".$row['listingsdbelements_field_value']."</td>";
    echo "<td>".$row['listingsdbelements_field_name']."</td>";
    echo "</tr>";
}
于 2013-09-25T15:47:29.503 回答