First things first. Use mysqli_ instead of mysql.
Secondly, if you are limiting the result to 1, then you dont need while loop.
Now, when you get id in get method, you can check it in database and get details:
You will have to fire the function getStatus() once you get the details from database.
if ($productCount == 1){
echo getStatus($row["ip"],$row["port"]);
} else {
echo "That item does not exist.";
}