# How to add my data from a database into a table?

**URL:** <https://forum.kirupa.com/t/how-to-add-my-data-from-a-database-into-a-table/227529>\
**Category:** programming\
**Created:** [May 31, 2007, 1:02am UTC](https://forum.kirupa.com/t/how-to-add-my-data-from-a-database-into-a-table/227529 "2007-05-31T01:02:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Flash\_Man1](https://avatars.discourse-cdn.com/v4/letter/f/8797f3/32.png) [@Flash\_Man1](https://forum.kirupa.com/u/Flash_Man1)\
**Post date:** [May 31, 2007, 1:02am UTC](https://forum.kirupa.com/t/how-to-add-my-data-from-a-database-into-a-table/227529/1 "2007-05-31T01:02:29Z")

</div>

Hey all,

This is a tad different from the usual insert…this script uses a class which creates a pdf using php…i want my data which is saved in a cookie and then saved into an array called $data…i want all the words in the $data array to appear in a table which is 4 columns by 5 rows.

Here is the code i have so far:

```php

<?php

if (!isset($words) || strlen($words)==0){
//$demotext='demo text';

$words = explode( ',', $_COOKIE['cookie1'] );
$data = implode( ',', $words );

//$words = unserialize( $_COOKIE['cookie1'] );
//print $_COOKIE['cookie1'];

//print $data;
}

include ('class.ezpdf.php');
$pdf =& new Cezpdf();
$pdf->selectFont('./fonts/Helvetica.afm');
//this commented code below if uncommented will create a table with the //data that is handcoded in...i need my data to be loaded from the variable. //using that code below?
/*$data = array(
array('num'=>1,'name'=>'gandalf','type'=>'wizard')
,array('num'=>2,'name'=>'bilbo','type'=>'hobbit','url'=>'http://www.ros.co.
nz/pdf/')
,array('num'=>3,'name'=>'frodo','type'=>'hobbit')
,array('num'=>4,'name'=>'saruman','type'=>'bad
dude','url'=>'http://sourceforge.net/projects/pdf-php')
,array('num'=>5,'name'=>'sauron','type'=>'really bad dude')
);*/
$pdf->ezTable($data);
$pdf->ezStream();
?>

```

Any ideas??

Cheers in advance peeps 😃
