0
public function get_Gol($idComp, $idSq){
    global $wpdb;
    $row = $wpdb->get_results($wpdb->prepare("SELECT count(F_id_gioc_Gol) FROM `ASD_Partite` p
        LEFT JOIN ASD_CALCIO_Partite_Gol cpg ON p.id = cpg.F_id_dett_partita
        WHERE p.F_id_comp = %d AND (p.F_id_sq1 = %d OR p.F_id_sq2 = %d) AND F_id_gioc_Gol = %d", $idComp, $idSq, $idSq, $this->idGioc));
    foreach ($row as $key => $v){

        return $v->count(F_id_gioc_Gol);
    }

问题是那$v->count(F_id_gioc_Gol);行不通。我怎样才能访问它?

4

1 回答 1

1

尝试以下操作:

SELECT count(F_id_gioc_Gol) as gioc_count  ...

...

return $v->gioc_count;

命名变量应该便于访问它。您还可以使用调试器或 var_dump 来查看如何在不命名的情况下访问获取的计数。

于 2013-04-08T10:56:40.447 回答