Re: [PHP] Adding a URL

2003-03-31 Thread Scott Thompson
Thank you, your suggestions worked perfectly!

~Scott

Don Read wrote:
On 30-Mar-2003 Scott Thompson wrote:

Hi,

I am using the following code to query a database and build an HTML
table.




/* Printing results in HTML */
print "\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {


$line['email'] =
 '' .$line['email'].'';

print "\t\n";
foreach ($line as $col_value) {
 print "\t\t$col_value\n";
}
print "\t\n";


// how about this ?

 echo "\n", implode('', $line), ''; 


}
print "\n";


 


What I want (and can't figure out) is how to have each email address 
have a URL (i.e. mailto:[EMAIL PROTECTED]).

I'm fairly new to PHP, I hope this question made some sense.

Suggestions?



Regards,


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


Re: [PHP] Adding a URL

2003-03-30 Thread Hugh Danaher
Scott,
try changing:
  print "\t\t$col_value\n";
to:
  print "\t\tmailto:".$col_value.";>$col_value\n";
Hope this helps.
Hugh

- Original Message -
From: "Scott Thompson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 29, 2003 8:53 PM
Subject: [PHP] Adding a URL


> Hi,
>
> I am using the following code to query a database and build an HTML table.
>
> 
>   
>SQL Connect
>   
>
>   
>  /* Connecting, selecting database */
>  $link = mysql_connect("localhost", "root", "")
>  or die("Could not connect");
>  //print "Connected successfully";
>  mysql_select_db("irvington") or die("Could not select database");
>
>  /* Performing SQL query */
>  $query = "SELECT * FROM staff";
>  $result = mysql_query($query) or die("Query failed");
>
>  /* Printing results in HTML */
>  print "\n";
>  while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
>  print "\t\n";
>  foreach ($line as $col_value) {
> print "\t\t$col_value\n";
>  }
>  print "\t\n";
>  }
>  print "\n";
>
>  /* Free resultset */
>  mysql_free_result($result);
>
>  /* Closing connection */
>  mysql_close($link);
>?>
>
>   
> 
>
>
> So far so good...
>
> The SQL query returns this:
> mysql> select * from staff;
> ++--+--+
> | name   | email| subject  |
> ++--+--+
> | Scott Thompson | [EMAIL PROTECTED] | Volunteer|
> | |   | Computer Science |
> | Some Teacher   | [EMAIL PROTECTED]   | some subject |
> ++--+--+
> 3 rows in set (0.00 sec)
>
> mysql>
>
> The above is also essentialy what you see in your browser (sans headers).
>
> So far so good...
>
> What I want (and can't figure out) is how to have each email address
> have a URL (i.e. mailto:[EMAIL PROTECTED]).
>
> I'm fairly new to PHP, I hope this question made some sense.
>
> Suggestions?
>
> ~Scott
>
>
> --
> 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] Adding a URL

2003-03-29 Thread Don Read

On 30-Mar-2003 Scott Thompson wrote:
> Hi,
> 
> I am using the following code to query a database and build an HTML
> table.
> 



>  /* Printing results in HTML */
>  print "\n";
>  while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

$line['email'] =
 '' .$line['email'].'';

>  print "\t\n";
>  foreach ($line as $col_value) {
>   print "\t\t$col_value\n";
>  }
>  print "\t\n";

// how about this ?

 echo "\n", implode('', $line), ''; 

>  }
>  print "\n";

 

> What I want (and can't figure out) is how to have each email address 
> have a URL (i.e. mailto:[EMAIL PROTECTED]).
> 
> I'm fairly new to PHP, I hope this question made some sense.
> 
> Suggestions?
> 

Regards,
-- 
Don Read   [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

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



[PHP] Adding a URL

2003-03-29 Thread Scott Thompson
Hi,

I am using the following code to query a database and build an HTML table.


 
  SQL Connect
 
 
  
/* Performing SQL query */
$query = "SELECT * FROM staff";
$result = mysql_query($query) or die("Query failed");
/* Printing results in HTML */
print "\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
print "\t\n";
foreach ($line as $col_value) {
print "\t\t$col_value\n";
}
print "\t\n";
}
print "\n";
/* Free resultset */
mysql_free_result($result);
/* Closing connection */
mysql_close($link);
  ?>
 

So far so good...

The SQL query returns this:
mysql> select * from staff;
++--+--+
| name   | email| subject  |
++--+--+
| Scott Thompson | [EMAIL PROTECTED] | Volunteer|
| |   | Computer Science |
| Some Teacher   | [EMAIL PROTECTED]   | some subject |
++--+--+
3 rows in set (0.00 sec)
mysql>

The above is also essentialy what you see in your browser (sans headers).

So far so good...

What I want (and can't figure out) is how to have each email address 
have a URL (i.e. mailto:[EMAIL PROTECTED]).

I'm fairly new to PHP, I hope this question made some sense.

Suggestions?

~Scott

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