adding of php rows on rows on excel

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

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

Re: adding of php rows on rows on excel

Post by landi » Fri Aug 08, 2014 12:30 am

Hi,
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 php.net 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)) {
       var_dump($row);
   }
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

-A

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 2 guests