<?php $mysqli = new mysqli("127.0.0.1", "root","", "mydatabase"); $query = "SELECT productid, name, price FROM product ORDER by name"; $result = $mysqli->query($query, MYSQLI_STORE_RESULT); while(list($productid, $name, $price) = $result->fetch_row()) echo "($productid) $name: $price <br />"; $result->free(); ?>