What's wrong with my php function?
I believe there must be something wrong with my php function's syntax but I'm not sure what it is.  Can anyone spot it?


    
    function sortByMetal() {
        global $conn;
    
        $query = "SELECT * FROM necklaces WHERE metal_id = 1 AND color_id = 2";
        $result = mysql_query($query, $conn);
    
        $output = "";
        while ($necklaces = mysql_fetch_array($result)) {
                $output .= $necklaces['name'];
        }
        return $output;
    }
What's wrong with my php function?
===

I believe there must be something wrong with my php function's syntax but I'm not sure what it is.  Can anyone spot it?


    
    function sortByMetal() {
        global $conn;
    
        $query = "SELECT * FROM necklaces WHERE metal_id = 1 AND color_id = 2";
        $result = mysql_query($query, $conn);
    
        $output = "";
        while ($necklaces = mysql_fetch_array($result)) {
                $output .= $necklaces['name'];
        }
        return $output;
    }