adding of php rows on rows on excel

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
php-forum Active User
php-forum Active User
Posts: 388
Joined: Thu Mar 15, 2012 3:59 pm

Fri Aug 08, 2014 12:30 am

A few suggestions:
1) Before you try and add the data to excel, why not just output the values to the browser in a loop? This will reduce your code size that we have to wade through. Once this works, adding it to excel is a second problem.

2) If you want to use the old functions (see #3) and you're reading more and a single piece of data, you might be better off with mysql_fetch_assoc and such like. The manual for this function contains an example of a loop to read multiple rows: (modified to suit yr context)

Code: Select all

   while($row=mysql_fetch_assoc($res)) {
3) From your code I suspect you are new at this (in which case welcome to php). Or using old code - in which case, you may want to read the warnings about using mysql_result instead of newer functions of mysqli and PDO_MySQL

Hope that helps


Post Reply