Hi All,
First time posting here. I've googled the problem, but can't seem to find a response that's the same.
All I want to do is have a list of id numbers and for each id number in the array, submit a MySQL query to retrieve information relating to the id number.
When I execute the code below however, I end up with only the last item in the array being printed in the echo statement.
Any clues?
Thanks,
// get array of ids
$ids = getIDs($ids);
// loop through input list
foreach ($ids as &$id) {
getVarDetails($id);
}
function getVarDetails($local)
{
$con = mysql_connect('localhost:3306', 'root', '********');
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// set database as Ensembl
mysql_select_db("Ensembl", $con);
$result = mysql_query("SELECT * FROM variations WHERE name = '$local' LIMIT 1");
$row = mysql_fetch_array($result)
while($row = mysql_fetch_array($result))
{
echo $row['name'] . " " . $row['id'];
echo "<br />";
}
// close connection
mysql_close($con);
}