From: Keary Suska <hierophant@pcisys.net>
To: Postgres-PHP <pgsql-php@postgresql.org>
Subject: Re: Mailtos and links from a query result table!
Date: Thu, 09 May 2002 16:13:12 -0600
Message-ID: <B9005097.E423%hierophant@pcisys.net> (raw)
In-Reply-To: <3CD2936400024AD8@nplex.globo.com>
on 5/9/02 2:32 PM, angelo.rigo@globo.com purportedly said:
> Hi!
> I need to make mailtos and hiperlinks in a query result table
> i dont know wich variable to pass to the <a href =""> to make this happen
Neither can we, since you don't give us your table schema, or the database
calls. What is your select statement? What function are you using to
retrieve rows?
> my code below is not working! any idea?
No. We have no idea what "not working" means. If you want help, you will
need to explicitly indicate what is not happening the way that you would
expect. And you should include all code for the algorithm (you can leave out
the pg_connect(), as that shouldn't be necessary, and is a security risk).
The snippet below is useless to determine what may be wrong.
> printf ("<tr bgcolor='$bgcolor'><td>%s</td><td>%s</td><td><a
> href='mailto:$myrow[19]'>%s</a></td><td><a
> href="$myrow[9]">%s</a></td><td>%s</td><td>%s</td></tr>
> ",$myrow[1], $myrow[2], $myrow[3], $myrow[19], $myrow[9], $myrow[10]);
> $row++;
> }
> while ($row < $numrows);
> printf ("</table>
> ");
> pg_close($db);
A tip: on top of using associative arrays as was mentioned in a previous
response, your use of printf() is superfluous and functions only to make
your code more difficult to read. This isn't C--use print():
print <<<EOS
<tr bgcolor='$bgcolor'>
<td>$myrow[1]</td>
<td>$myrow[2]</td>
<td><a href='mailto:$myrow[19]'>$myrow[3]</a></td>
<td><a href="$myrow[9]">$myrow[19]</a></td>
<td>$myrow[9]</td><td>$myrow[10]</td>
</tr>
EOS;
Much cleaner, no?
Keary Suska
Esoteritech, Inc.
"Leveraging Open Source for a better Internet"
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: hierophant@pcisys.net
Subject: Re: Mailtos and links from a query result table!
In-Reply-To: <B9005097.E423%hierophant@pcisys.net>
References: <3CD2936400024AD8@nplex.globo.com> <B9005097.E423%hierophant@pcisys.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox