I'm testing this code
$query = "SELECT * from `items` where category_id=?";
$stmt = $mysqli->query($query);
$stmt->bind_param("s", $category_id);
$stmt->execute();
$result = $stmt->get_result();
while ($row = $stmt->fetch_assoc()) {
printf ("%s (%s)\n", $row['name'], $row['code']);
}
Is there any easier way to output whole table to HTML markup?
The following code snippet can match your requirements..but i'm not sure whether this is easier way or not..Hope this will help.
For the php,
$pricequery="SELECT price FROM technoxchange";
$result=mysql_query($pricequery);
while($row= mysql_fetch_array($result)){
$prices [] = $row['price'];
}
echo json_encode( array( 'prices' => $prices ) );
For the js,
var p;
$.get("getTechnoXchange.php", function(data){
p = data.prices;
});
$('#priceUnicus').html( p[0] );
$('#priceHire').html( p[1] );
$('#priceMonsterArena').html( p[2] );