Re: [PHP] Selecting a Queried Row

2002-03-11 Thread Andre Dubuc

Hi Hugh,

Thank you so much for the code: it's exactly what I was looking for. Sorry 
about the delay in replying: we had a major power outage: went out Saturday  
at 8 p.m. and we finally got it back Monday at 3:15p.m. (with multiple 
on/offs!). The phone went dead as well. Great fun!

Anyway, I'd like to get back to you, once I get some files back in order. 
that were messed up forrm the crash shutdowns.

Thanks again,
Andre



On Saturday 09 March 2002 21:02, you wrote:
> Andre,
>
> The following code block is from a site I'm developing for a local museum.
> The site is now located at www.ironorchid.com/museum/  but will move
> eventually to its own site.  In it, I have a list of the landmark trees,
> with links to a map showing the location of the tree, a link to
> maps.yahoo.com to get a detailed map of the location and or driving
> directions, and links to show all the trees in an area of the city.  In
> other words, the table is link crazy--sounded enough like what you want to
> do that I responded to your question.  All of the data in the html table
> comes from a mysql database with three database tables (heritage, trees,
> sites).
> If you use the mysql_fetch_array() command in a WHILE statement, you create
> an array of the row or rows resultant from your query and have the mysql
> column titles as your array keys.  You can then use the  to put a link under the words in your table cells and generate the html
> code to go to the next row of data.
> As I said earlier, I have the bad habit of writing everything in php once I
> need it on a page, so the code block might be a bit hard to read.  Let me
> know if you need further details on what's provide.
> Hope this helps,
> Hugh
>
>  print " border=1 >";
>  print "ID #  title=\"scientific name\">Common
> NameAddressDistrictb
>
> >";
>
>  $db="some_database";
>  $pass="some_password";
>  $link=mysql_connect("localhost","","$pass");
>  if (! $link) die("Can't log in at this time");
>  mysql_select_db($db,$link) or die ("Can't log in at this time");
>  $query="select * from heritage where asset_num>'0' order by asset_num";
>  $result=mysql_query($query);
>  if (!$result) die(mysql_error());
>  while ($heritage=mysql_fetch_array($result))
>   {
>   $query2="select * from trees where id='".$heritage['plant_num']."' ";
>   $result2=mysql_query($query2);
>   $trees=mysql_fetch_array($result2);
>   $query3="select * from sites where plant_num='".$heritage['plant_num']."'
> ";
>   $result3=mysql_query($query3);
>   $num=0;
>   while ($sites=mysql_fetch_array($result3))
>{
>$links[$num]=$sites['link'];
>$num=$num+1;
>}
>   print " href=mapmastr.php?list1=1&tree=1&coordinate_x=".$heritage['x']."&coordinate
>_ y=".$heritage['y']." title=\"".stripslashes($trees['scientific_name'])."
> native to ".$trees['native_to']."\">  ".$heritage['asset_num']."
>  ".stripslashes($trees['common_name'])."
> href=http://maps.yahoo.com/py/maps.py?BFCat=&Pyt=Tmap&newFL=Use+Address+Bel
>o w&addr=".ereg_replace (" ", "+",
> stripslashes($heritage['address']))."&csz=".$heritage['zip']."&Country=us&G
>e t%A0Map=Get+Map title=\"go to maps.yahoo.com to get a map of this
> address\">  ".stripslashes($heritage['address'])."
> href=mapmastr.php?district=".$heritage['town_name']." title=\"see the
> location of all Landmark Trees in the ".$heritage['town_name']."
> District\">  ".$heritage['town_name']."";
>   }
>  mysql_close($link);
> print "";
> ?>
>
> - Original Message -
> From: "Andre Dubuc" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, March 09, 2002 4:12 PM
> Subject: [PHP] Selecting a Queried Row
>
> > As a newbie at PHP (and relative newcomer to HTML and web design) I've
>
> been
>
> > wading through documentation trying to accomplish various tasks. However,
>
> I'm
>
> > stumped on how to proceed with the following:
> >
> > I would like a web vistor to be able to select a row from a table that
> > has been generated from a query. The problem is I don't know how to code
> > a paricular column (using the present  . .  syntax of the table)
> > so that each cell would have a "clickable" element (perhaps the 'ID'
> > number).
> >
> > Once that cell is clicked, I would like to code 'onclick=some_function()'
> >
> > Does this sound reasable way of approaching the problem, or is there a
>
> better
>
> > way. [Btw, at present, while learning PHP, I am using
> > global_variables=on, but would like to try $PHP_SELF method to pick up
> > session variables.]
> >
> > Any help would be greatly appreciated, as well as pointers of where to
>
> look!
>
> > Tia, Andre
> >
> >
> > --
> > Please pray the Holy Rosary to end the holocaust of abortion.
> > Remember in your prayers the suffering souls in Purgatory.
> >
> > May God bless you abundantly in His love!
> >
> > For a free Cenacle Scriptural Rosary Booklet --
>
> http://www.webhart.net/csrb/
>
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://ww

Re: [PHP] Selecting a Queried Row

2002-03-09 Thread hugh danaher

Andre,

The following code block is from a site I'm developing for a local museum.
The site is now located at www.ironorchid.com/museum/  but will move
eventually to its own site.  In it, I have a list of the landmark trees,
with links to a map showing the location of the tree, a link to
maps.yahoo.com to get a detailed map of the location and or driving
directions, and links to show all the trees in an area of the city.  In
other words, the table is link crazy--sounded enough like what you want to
do that I responded to your question.  All of the data in the html table
comes from a mysql database with three database tables (heritage, trees,
sites).
If you use the mysql_fetch_array() command in a WHILE statement, you create
an array of the row or rows resultant from your query and have the mysql
column titles as your array keys.  You can then use the ";
 print "ID # Common
NameAddressDistrict";

 $db="some_database";
 $pass="some_password";
 $link=mysql_connect("localhost","","$pass");
 if (! $link) die("Can't log in at this time");
 mysql_select_db($db,$link) or die ("Can't log in at this time");
 $query="select * from heritage where asset_num>'0' order by asset_num";
 $result=mysql_query($query);
 if (!$result) die(mysql_error());
 while ($heritage=mysql_fetch_array($result))
  {
  $query2="select * from trees where id='".$heritage['plant_num']."' ";
  $result2=mysql_query($query2);
  $trees=mysql_fetch_array($result2);
  $query3="select * from sites where plant_num='".$heritage['plant_num']."'
";
  $result3=mysql_query($query3);
  $num=0;
  while ($sites=mysql_fetch_array($result3))
   {
   $links[$num]=$sites['link'];
   $num=$num+1;
   }
  print "  ".$heritage['asset_num']."
 ".stripslashes($trees['common_name'])."
   http://maps.yahoo.com/py/maps.py?BFCat=&Pyt=Tmap&newFL=Use+Address+Belo
w&addr=".ereg_replace (" ", "+",
stripslashes($heritage['address']))."&csz=".$heritage['zip']."&Country=us&Ge
t%A0Map=Get+Map title=\"go to maps.yahoo.com to get a map of this address\">
 ".stripslashes($heritage['address'])."
   
 ".$heritage['town_name']."";
  }
 mysql_close($link);
print "";
?>

- Original Message -
From: "Andre Dubuc" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 09, 2002 4:12 PM
Subject: [PHP] Selecting a Queried Row


> As a newbie at PHP (and relative newcomer to HTML and web design) I've
been
> wading through documentation trying to accomplish various tasks. However,
I'm
> stumped on how to proceed with the following:
>
> I would like a web vistor to be able to select a row from a table that has
> been generated from a query. The problem is I don't know how to code a
> paricular column (using the present  . .  syntax of the table) so
> that each cell would have a "clickable" element (perhaps the 'ID' number).
>
> Once that cell is clicked, I would like to code 'onclick=some_function()'
>
> Does this sound reasable way of approaching the problem, or is there a
better
> way. [Btw, at present, while learning PHP, I am using global_variables=on,
> but would like to try $PHP_SELF method to pick up session variables.]
>
> Any help would be greatly appreciated, as well as pointers of where to
look!
>
> Tia, Andre
>
>
> --
> Please pray the Holy Rosary to end the holocaust of abortion.
> Remember in your prayers the suffering souls in Purgatory.
>
> May God bless you abundantly in His love!
>
> For a free Cenacle Scriptural Rosary Booklet --
http://www.webhart.net/csrb/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Selecting a Queried Row

2002-03-09 Thread Stephano Mariani

If you mean what I think you mean:

Some Text (ID?)

> -Original Message-
> From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, 10 March 2002 12:13 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Selecting a Queried Row
> 
> As a newbie at PHP (and relative newcomer to HTML and web design) I've
> been
> wading through documentation trying to accomplish various tasks.
However,
> I'm
> stumped on how to proceed with the following:
> 
> I would like a web vistor to be able to select a row from a table that
has
> been generated from a query. The problem is I don't know how to code a
> paricular column (using the present  . .  syntax of the
table) so
> that each cell would have a "clickable" element (perhaps the 'ID'
number).
> 
> Once that cell is clicked, I would like to code
'onclick=some_function()'
> 
> Does this sound reasable way of approaching the problem, or is there a
> better
> way. [Btw, at present, while learning PHP, I am using
global_variables=on,
> but would like to try $PHP_SELF method to pick up session variables.]
> 
> Any help would be greatly appreciated, as well as pointers of where to
> look!
> 
> Tia, Andre
> 
> 
> --
> Please pray the Holy Rosary to end the holocaust of abortion.
> Remember in your prayers the suffering souls in Purgatory.
> 
> May God bless you abundantly in His love!
> 
> For a free Cenacle Scriptural Rosary Booklet --
> http://www.webhart.net/csrb/
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Selecting a Queried Row

2002-03-09 Thread Stephano Mariani

If you mean what I think you mean:

Some Text (ID?)

> -Original Message-
> From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, 10 March 2002 12:13 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Selecting a Queried Row
> 
> As a newbie at PHP (and relative newcomer to HTML and web design) I've
> been
> wading through documentation trying to accomplish various tasks.
However,
> I'm
> stumped on how to proceed with the following:
> 
> I would like a web vistor to be able to select a row from a table that
has
> been generated from a query. The problem is I don't know how to code a
> paricular column (using the present  . .  syntax of the
table) so
> that each cell would have a "clickable" element (perhaps the 'ID'
number).
> 
> Once that cell is clicked, I would like to code
'onclick=some_function()'
> 
> Does this sound reasable way of approaching the problem, or is there a
> better
> way. [Btw, at present, while learning PHP, I am using
global_variables=on,
> but would like to try $PHP_SELF method to pick up session variables.]
> 
> Any help would be greatly appreciated, as well as pointers of where to
> look!
> 
> Tia, Andre
> 
> 
> --
> Please pray the Holy Rosary to end the holocaust of abortion.
> Remember in your prayers the suffering souls in Purgatory.
> 
> May God bless you abundantly in His love!
> 
> For a free Cenacle Scriptural Rosary Booklet --
> http://www.webhart.net/csrb/
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php