Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create table using PEAR with PHP? [closed]

Tags:

php

pear

Hi I am using following code to display the table but it shows the error like this.

Warning: require(HTML/Table.php) [function.require]: failed to open stream: No such file or directory in /home/aspire/public_html/table.php on line 3

Fatal error: require() [function.require]: Failed opening required 'HTML/Table.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/aspire/public_html/table.php on line 3

This is my code. Can anyone tell me what mistake I did.

 require("HTML/Table.php");
 $tableStyle = array("bgcolor"=>"#FFFFFF", "border"=>"1", "width"=>"150",   "cellpadding"=>"1", "cellspacing"=>"2"); 
 $colA = array("field 1", "field 2", "field 3", "", "<b>TOTAL</b>");
 $a = 10;
 $b = 15;
 $c = 8;
 $total = $a+$b+$c;
 $colB = array($a, $b, $c, "", "<b>".$total."</b>");
 $table = new HTML_Table($tableStyle);
 $table->addCol($colA);
 $table->addCol($colB);
 $table->display();

Using this "php go-pear.phar" command I found the following path.

Current include path           : .:/usr/share/php:/usr/share/pear
Configured directory           : /home/aspire/pear/share/pear
Currently used php.ini (guess) : /etc/php5/cli/php.ini

So when specify the path before start my code like

 include_path=".:/usr/share/php:/usr/share/pear/";

it shows the error like

Parse error: syntax error, unexpected '=' in /home/aspire/public_html/table.php on line 2

How to solve this problem.

like image 808
Prusothaman Varatharaj Avatar asked Jul 19 '26 01:07

Prusothaman Varatharaj


1 Answers

Trying your sample code, I got the error message:

PHP Warning:  require(HTML/Table.php): failed to open stream: No such file or directory in /home/dylan/Desktop/scratch/pear_path.php on line 3
PHP Fatal error:  require(): Failed opening required 'HTML/Table.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/dylan/Desktop/scratch/pear_path.php on line 3

I resolved this and the program appears to work fine after doing:

sudo pear install HTML_Table

If you're having issues package versions you might try the pear force option.

sudo pear install -f --alldeps HTML_Table

I found this here: http://grokbase.com/p/php/pear-general/05ak6rnj7m/pear-problem-installing-db-dataobject-formbuilder-frontend

like image 52
ddoxey Avatar answered Jul 20 '26 14:07

ddoxey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!