473,320 Members | 2,052 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

PEAR::HTML_Table question: link in cell

Hi to everyone,

I'm relatively new to php and to PEAR in particular.

I'm using PEAR, especially the HTML_Table package. It's almost clear
how the things work, but I've a question for which I'll appreciate
your opinions.

I fetch some record from a MySQL db and print them out on a table with
addRow() method: no problem until here.
But how I can do the same if I want to put a link in some cells.
For example, I want soomething like this:

| 1 | apple | 2,90 | available |
| 2 | pear | 1,90 | available |
| 3 | orange | 3,00 |not available |

and I want that apple, pear and orange are link to other pages, that
is, I want to put an "<a href="..."> tag in the second colum of the
table

| 1 |<a href="..."> apple</a> | 2,90 | available |
| 2 | <a href="...">pear</a> | 1,90 | available |
| 3 |<a href="..."> orange </a>| 3,00 | not available |

I think I should could use setCellValue(), but can you help me to find
an "elegant" and efficient solution?

I do not ask for the code, only some hint (however, some pieces of
code will be appreciated :-) )

Hoping someone could help me, thanks in advance.

Bye
Robbie

Jul 17 '05 #1
1 2262
Robbie wrote:
I think I should could use setCellValue(), but can you help me to find
an "elegant" and efficient solution?

I do not ask for the code, only some hint (however, some pieces of
code will be appreciated :-) )

Hoping someone could help me, thanks in advance.


Well, addRow() takes an array of arguments as the first value, so you
do something like this:

....
$_row = array ("<a href=\"foobar.html\">foobar</a>",
"12.95USD",
"available");
$table->addRow($_row);
....

HTML_Table doesn't care what the data in the cells is. Ofcourse you can
set the value later, but the cell must exist for you to do that.

/Marcin
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: me | last post by:
Recent articles have got me looking at PEAR again. Because it is not always available, is it worth getting tied to? After all, if I write for it and it isn't there, my code won't work.
8
by: red | last post by:
I have PHP Version 5.0.1 installed on my computer, and according to the pear manual pear is already installed. But how do I tell if it is installed ? for example, how do I get this line, which I...
0
by: Chris | last post by:
Hi, i have been trying to install PEAR PHP package on my windows XP system but i am having some problems. I am running PHP 5.0.0, with Apache 2.0.50, and i am using the go-pear.php install...
1
by: DJ Majestik | last post by:
OK, I am new to the whole PEAR/Smarty templating thing. I am trying to setup my directory structure correctly. If someone could weigh in and see if I have this setup "right", I would appreciate it....
3
by: Mladen Gogala | last post by:
I am unable to reach PEAR server. Here is the error message: # pear upgrade-all XML_RPC_Client: Connection to RPC server pear.php.net:80 failed. Connection timed out Anybody knows what's going...
3
by: bob.herbst | last post by:
I have been trying to use HTML_Table from PEAR to write a PHP script that will access a database and retrieve my data into an HTML table that can be sorted by column. Currently I am using the...
1
by: Julien Sobrier | last post by:
Hello, I can't install the pear package HTML_Table: # pear install HTML_Table Warning: xml_parse() http://www.php.net/function.xml-parse]: Unable to call handler _pkginfo_cdata_2_0() in...
3
by: Mladen Gogala | last post by:
PEAR installation failed with PHP 5.2.0 on Windows XP. The reported error is mismatch between array types. Did anyone else come across that? Any solutions? I didn't have any problems with Linux: ...
1
by: IchBin | last post by:
I remember having problems with pear when I first installed it but got it running some time ago. This is on a windoze XP SP OS. I did not think it was correct because it pointed to...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.