From: | angelo(dot)rigo(at)globo(dot)com |
---|---|
To: | pgsql-php(at)postgresql(dot)org |
Subject: | mailto´s hyperlink solution |
Date: | 2002-05-16 18:16:34 |
Message-ID: | 3CD293640004B005@nplex.globo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-php |
Thank´s for who gave me support!
I fix the problem of making mailto´s and hyperlinks from a select, using
the pg_fetch_array function the code is below:
<?php
$db = pg_connect("dbname=db user=me");
$query = "SELECT nome, prof, email, hp FROM table";
$result = pg_exec($db, $query);
if (!$result) {printf ("ERROR"); exit;}
$numrows = pg_numrows($result);
$row=0;
printf ("<table border=0>
");
printf ("<tr bgcolor='#FFCC00'><td><b>Nome</b></td><td><b>Profisão</b></td><td><b>Email</b></td><td><b>Website</b></td></tr>
");
do
{
$myrow = pg_fetch_array ($result,$row);
if($row % 2) {
$bgcolor="#CCCCCC";
}
else {
$bgcolor="#EEF0EE";
}
printf ("<tr bgcolor='$bgcolor'><td>%s</td><td>%s</td><td><a href='mailto:$myrow[email]'>%s</a></td><td><a
href='http://$myrow[hp]' target='_blank'>%s</a></td></tr>
", $myrow[nome], $myrow[prof], $myrow[email], $myrow[hp]);
$row++;
}
while ($row < $numrows);
printf ("</table>
");
pg_close($db);
?>
________________________________________
A busca mais veloz e precisa da internet. Acesse agora: http://www.zoom.com.br.
From | Date | Subject | |
---|---|---|---|
Next Message | Eckhard Hoeffner | 2002-05-18 07:26:24 | using CURSOR with PHP |
Previous Message | Eckhard Hoeffner | 2002-05-16 13:53:35 | Re: email and postgresql |