is that correct to collect id by function

I built a little advanced import MySQL and this last didn’t work. I dont know whats the problem. studid recive empty

function getid($conf){
    $q = "select id from student where studid=$conf";
    $r = mysql_query($q);

    return $r;

if (strcmp($fil,$course)==0) {
     if($_FILES["file"]["size"] > 0)
        $file = fopen($filename, "r");
        while (($emapData = fgetcsv($file, 10000, ",")) !== FALSE)
            $con = getid($conf);

            $sql = "INSERT into studentsubject (`studid`, `classid`, `Dw`, 
               `Ts`,Ex, `Av`) 

            //we are using mysql_query function. it returns a resource on true 
            else False on error
            $result = mysql_query( $sql, $conn );
            if(! $result )
                echo "<script type=/"text/javascript/">
                          alert(/"Invalid File:Please Upload CSV File./");
                          window.location = /"../import.php/"

For starters you are returning the recordset to $con instead of the student id:

function getid($conf){
    $q = "select id from student where studid=".$conf;
    $r = mysql_query($q);
    $x = mysql_fetch_row($r);
    return $x[0];  //field 0 of the row