Jump to content

GuardPH

New Members
  • Posts

    5
  • Joined

  • Last visited

GuardPH's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Yes did that already... while($row=mysqli_fetch_array($result, MYSQL_NUM)) { $data[] = $row; } $xls->addRow($data); This is the Error: Undefined offset: 0 in /pathe/export-xls.class.php on line 69 public function addRow($row) { #Accepts an array or var which gets added to the spreadsheet body if(is_array($row)) { #check for multi dim array if(is_array($row[0])) { <================== line 69 foreach($row as $key=>$array) { $this->bodyArray[] = $array; } } else { $this->bodyArray[] = $row; } } else { $this->bodyArray[][0] = $row; } }
  2. Tried but didn't work... any idea?
  3. Oh btw, this is the addrow function public function addRow($row) { #Accepts an array or var which gets added to the spreadsheet body if(is_array($row)) { #check for multi dim array if(is_array($row[0])) { foreach($row as $key=>$array) { $this->bodyArray[] = $array; } } else { $this->bodyArray[] = $row; } } else { $this->bodyArray[][0] = $row; } } Ill try this
  4. I'm trying to insert the result of Query to an Array so that xport-xls.class.php can render the value... $data = array(); while($row=mysql_fetch_array($result)) { echo $row['data1']; echo $row['data2']; echo $row['data3']; $data[] = $row; } currently the example given is this and this is working... but said we can use data from SQL query as well so thats what i'm trying to do. Thanks! #add a multi dimension array $row = array(); $row[] = array(0 =>'Luke', 1=>'6', 2=>'2ft'); $xls->addRow($row);
  5. Hi... How do you insert MYSQL Query Result to Arrays $user = $_GET["user_name"]; $con=mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); if (mysqli_connect_errno()){ echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $result = mysqli_query($con,"SELECT data1, data2, FROM datatable"); while($row=mysql_fetch_array($result)){ echo $row['data1']; echo $row['data2']; echo $row['data3']; } # $row[] = "data1"; $row[] = "data2"; $row[] = "data2"; $xls->addRow($row); # or multidimentional array $row = array(); $row[] = array(0 =>'data1', 1=>'data2', 2=>'data3'); $xls->addRow($row);
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.