too long

This question already has an answer here:

I am trying to get some rows from a table that has columns row_ID,c_ID, e_ID, each e_ID can have different c_ID's. I use the mysql_fetch_array to get all c_ID's that are associated to a certain ID.

$result=mysql_query("SELECT c_ID from User_Competence WHERE e_ID=".$id);
            $test=mysql_fetch_array($result);
            print_r ($test['c_ID']);

But instead of getting several c_IDs for each e_ID, I get only one value in the array. Am I missing something in the query?

</div>

No, you do not have any errors. if e_ID is unique you will only get one result. You may want to try this if e_ID is not unique:

$result=mysql_query("SELECT c_ID from User_Competence WHERE e_ID=".$id);
while($test=mysql_fetch_array($result))
{
    print_r ($test['c_ID']);
}

try this to get all ids

   $id = mysql_real_escape_string($id); // escape your variable here before u use it in the query

   $result=mysql_query("SELECT c_ID from User_Competence WHERE e_ID='".$id."' ");
        while ($test=mysql_fetch_array($result) ){
        echo $test['c_ID'].'<br />';
            }