Hi all,
Been pulling my hair out on this one. I have a simple query:
$query = ("
SELECT
course_code,
student_grade,
start_date
FROM
ccdata
WHERE
student_id = '$local_id'
AND
start_date= '20091023'
")
$result2 = $mysqli->query($query, MYSQLI_STORE_RESULT);
//$total_courses_I = $result2->num_rows;
while ($obj2 = $result2->fetch_row())
{
$course_code = $obj2[0];
$ypos += 5;
$data = $course_code ;
$pdf->SetXY($xpos, $ypos) ;
$pdf->Cell(32.5,5,$data,1,1,'L',true);
$row_c ++;
}
start_date is a text field
According to PHPMYADMIN I have 4 courses for this date and student.
When I run this it only shows 3.
If I change the query from:
start_date= '20091023'
to
(SUBSTRING(start_date ,1,4) = '$school_year') //school year =2009
It then shows this missing course + plus others for other dates in 2009.
The start_date in phpmyadmin is 20091023 for 4 courses....
Why can't I query that exact string and get all four records?
Also if i uncomment num_rows then it says 4 too!!! But only three are shown