This may not mean much, but:
if( $data = $query->fetchrow_array() )
is suspect to me. It will always, in this case, give you zero or 1. I suspect you want:
if( ($data) = $query->fetchrow_array() )
That may not fix your problem, but it is a bug.
------ We are the carpenters and bricklayers of the Information Age. Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement. Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified. |