I'm assuming that all you want to do for the moment is get data from the database ... here's the basic steps:
//(1) Build your SQL:
$sql = "SELECT location FROM portfolio WHERE number=".$num;
//(2) Get the results, comes back as a resource id:
$res = mysql_query($sql, $db);
//(3) Extract the data, row by row, assuming that there is
// (possibly) more than one result of the query.
while($obj = mysql_fetch_row($res)){
// $obj is now an array of data
echo $obj['location'];
}
mysql_fetch_row is a common way of returning a 'row' of data, but there are alternatives:
mysql_fetch_array returns a normal array ($obj[0] is the first item, $obj[1] is the second, etc.)
Also, is mysql_fetch_object, which lets reference the data in the form $obj->location.
Hope that gets you on your way.