<? mysql_connect("localhost","root",""); mysql_select_db("mydatabase"); $query = "SELECT id, title FROM mytable ORDER BY title"; $result = mysql_query($query); while ($row = mysql_fetch_array($result, MYSQL_NUM)) { $title = $row[1]; $id = $row[0]; echo "Product: $title ($id) <br />"; } ?>