开发者

why is only one row being returned from the mysql query

I have this query:

mysql_query( "SELECT tre.TrainerEducationID, tge.EducationName, tre.EducationNote
              FROM trainereducation tre
              INNER JOI开发者_StackOverflowN trainingeducation tge ON 
                (tre.EducationID = tge.EducationID)
              WHERE tre.TrainerID = '$id'" );

It apparently is only returning a single row, even though there are more than 2 rows in the TrainerEducation table.

Why is that?

Shouldn't it return more than one row?


Then use:

while ($row = mysql_fetch_array($result)) { // keep fetching until it returns false
    var_dump($row);
}

As posted on: http://php.net/mysql_fetch_array


mysql_fetch_array does fetch one row only. Try doing it in a loop like this:

$all_rows = array();
while($row = mysql_fetch_array($result)) {
  $all_rows[] = $row;
}


Maybe your conditions don't match, try using left join instead for debugging and see what you get

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜