Mailtos and links from a query result table!

Mailtos and links from a query result table!

am 09.05.2002 22:32:37 von angelo.rigo

Hi!
I need to make mailtos and hiperlinks in a query result table
i dont know wich variable to pass to the to make this happen

my code below is not working! any idea?

printf ("%s%s
to:$myrow[19]'>%s href=3D"$myrow[9]">%s%s%s
",$myrow[1], $myrow[2], $myrow[3], $myrow[19], $myrow[9], $myrow[10]);
$row++;
}
while ($row < $numrows);
printf ("
");
pg_close($db);
?>



________________________________________
A busca mais veloz e precisa da internet. Acesse agora: http://www.zoom.com=
..br.


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Re: Mailtos and links from a query result table!

am 09.05.2002 22:43:17 von pgerzson

2002. május 9. 22:32 dátummal angelo.rigo@globo.com ezt írta:
>Hi!
>I need to make mailtos and hiperlinks in a query result table
>i dont know wich variable to pass to the to make this
> happen

I suggest to you using named fields.You can achieve this by calling
pg_fetch_array with PGSQL_ASSOC parameter (or pg_fetch_object())

$myrow = pg_fetch_array($result, $row, PGSQL_ASSOC);

Then you can use $myrow['email'], etc, whatever you named those columns
in postgres.

>
>my code below is not working! any idea?
>
>printf ("%s%s > href='mailto:$myrow[19]'>%s
> href="$myrow[9]">%s%s%s
>",$myrow[1], $myrow[2], $myrow[3], $myrow[19], $myrow[9], $myrow[10]);
>$row++;
>}
>while ($row < $numrows);
>printf ("
>");
>pg_close($db);
>?>
>
>
>
>________________________________________
>A busca mais veloz e precisa da internet. Acesse agora:
> http://www.zoom.com.br.
>
>
>---------------------------(end of
> broadcast)--------------------------- TIP 4: Don't 'kill -9' the
> postmaster

--
Papp, Gyõzõ
- pgerzson@freestart.hu

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

Re: Mailtos and links from a query result table!

am 09.05.2002 23:31:50 von Surojit Niyogi








Doing this would be good also if you expect to alter your table in the future.
 



-Surojit



Papp Gyozo wrote:


2002. május 9. 22:32 dátummal  ezt írta:


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



I suggest to you using named fields.You can achieve this by calling
pg_fetch_array with PGSQL_ASSOC parameter (or pg_fetch_object())

$myrow = pg_fetch_array($result, $row, PGSQL_ASSOC);

Then you can use $myrow['email'], etc, whatever you named those columns
in postgres.



my code below is not working! any idea?

printf ("<tr bgcolor='$bgcolor'><td>%s</td><td>%s</td><td><a
href=']'>%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 busca mais veloz e precisa da internet. Acesse agora:
.


---------------------------(end of
broadcast)--------------------------- TIP 4: Don't 'kill -9' the
postmaster








Re: Mailtos and links from a query result table!

am 10.05.2002 00:13:12 von Keary Suska

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 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 ("%s%s > href='mailto:$myrow[19]'>%s
> href="$myrow[9]">%s%s%s
> ",$myrow[1], $myrow[2], $myrow[3], $myrow[19], $myrow[9], $myrow[10]);
> $row++;
> }
> while ($row < $numrows);
> printf ("
> ");
> 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 <<
$myrow[1]
$myrow[2]


$myrow[9]$myrow[10]


EOS;

Much cleaner, no?

Keary Suska
Esoteritech, Inc.
"Leveraging Open Source for a better Internet"


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly