From angelo.rigo@globo.com Thu May 9 20:32:18 2002 Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id DE2CF475CC0 for ; Thu, 9 May 2002 16:32:18 -0400 (EDT) Received: from nplex.globo.com (email.globo.com [200.208.9.53]) by postgresql.org (Postfix) with ESMTP id 9B7B2475C40 for ; Thu, 9 May 2002 16:31:41 -0400 (EDT) Received: by nplex.globo.com (5.1.061) id 3CD2936300030780 for pgsql-php@postgresql.org; Thu, 9 May 2002 17:32:38 -0300 Message-ID: <3CD2936400024AD8@nplex.globo.com> Date: Thu, 9 May 2002 17:32:37 -0300 From: angelo.rigo@globo.com Subject: Mailtos and links from a query result table! To: pgsql-php@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable X-Archive-Number: 200205/45 X-Sequence-Number: 1177 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%s%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. From pgerzson@freestart.hu Thu May 9 20:44:05 2002 Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id E910C475CFA for ; Thu, 9 May 2002 16:44:05 -0400 (EDT) Received: from pompom.freestart.hu (pompom.freestart.hu [213.197.64.6]) by postgresql.org (Postfix) with ESMTP id 77017475CEE for ; Thu, 9 May 2002 16:44:01 -0400 (EDT) Received: from line-69-39.dial.freestart.hu ([213.197.69.39] helo=there) by freestart.hu with smtp (Freestart relay 1 (FS-Lin)) id 175ul4-0000Vt-00; Thu, 09 May 2002 22:43:27 +0200 Content-Type: text/plain; charset="iso-8859-2" From: Papp Gyozo Reply-To: pgerzson@freestart.hu To: angelo.rigo@globo.com, pgsql-php@postgresql.org Subject: Re: Mailtos and links from a query result table! Date: Thu, 9 May 2002 22:43:17 +0200 X-Mailer: KMail [version 1.3.1] References: <3CD2936400024AD8@nplex.globo.com> In-Reply-To: <3CD2936400024AD8@nplex.globo.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: X-Scanner: exiscan by Freestart X-Archive-Number: 200205/46 X-Sequence-Number: 1178 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 From surojit@bungeecode.com Thu May 9 22:31:42 2002 Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id E3B544759C3 for ; Thu, 9 May 2002 18:31:42 -0400 (EDT) Received: from noon.pghoster.com (unknown [64.246.32.44]) by postgresql.org (Postfix) with ESMTP id 892DB475B6E for ; Thu, 9 May 2002 18:31:41 -0400 (EDT) Received: from bungeecode.com (cs666899-134.austin.rr.com [66.68.99.134]) (authenticated (0 bits)) by noon.pghoster.com (8.11.6/8.11.6) with ESMTP id g49MUA916688; Thu, 9 May 2002 17:30:10 -0500 Message-ID: <3CDAEAC6.50205@bungeecode.com> Date: Thu, 09 May 2002 16:31:50 -0500 From: Surojit Niyogi User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.0+) Gecko/20020508 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgerzson@freestart.hu Cc: angelo.rigo@globo.com, pgsql-php@postgresql.org Subject: Re: Mailtos and links from a query result table! References: <3CD2936400024AD8@nplex.globo.com> Content-Type: text/html; charset=ISO-8859-2 Content-Transfer-Encoding: 8bit X-Archive-Number: 200205/48 X-Sequence-Number: 1180 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 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 <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='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 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
    

  

From hierophant@pcisys.net Thu May 9 22:13:47 2002 Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 9D59047642B for ; Thu, 9 May 2002 18:13:47 -0400 (EDT) Received: from leo.pcisys.net (leo.pcisys.net [207.76.102.240]) by postgresql.org (Postfix) with ESMTP id C891747591F for ; Thu, 9 May 2002 18:13:10 -0400 (EDT) Received: from [208.202.106.186] (moe1.meg106-186.cos.pcisys.net [208.202.106.186]) by leo.pcisys.net (8.12.1/8.12.1) via ESMTP id g49MDCOh003895 for ; Thu, 9 May 2002 16:13:12 -0600 (MDT) env-from (hierophant@pcisys.net) User-Agent: Microsoft-Outlook-Express-Macintosh-Edition/5.0.4 Date: Thu, 09 May 2002 16:13:12 -0600 Subject: Re: Mailtos and links from a query result table! From: Keary Suska To: Postgres-PHP Message-ID: In-Reply-To: <3CD2936400024AD8@nplex.globo.com> Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-Archive-Number: 200205/47 X-Sequence-Number: 1179 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[3] $myrow[19] $myrow[9]$myrow[10] EOS; Much cleaner, no? Keary Suska Esoteritech, Inc. "Leveraging Open Source for a better Internet"