MySQL Forums
Forum List  »  PHP

Re: noob qestion
Posted by: Ulf Wendel
Date: January 13, 2006 12:49PM

fieryphoenix79 wrote:
> i have this code and i would like the email output
> to be a href link but i dont know how to do it in
> php can someone show me? Note this will put the
> email($r->email) out just not in a link.

Please remember that this is a MySQL specific forum. Your question is on HTML. Not on PHP not on MySQL.

Please learn a little more about HTML and the anchor (<a ... >) tag. Learn what <a href="mailto:me@example.com">Mail me</a> does.


> BTW: i tried <a href = "echo "<td
> valign='top'
> align='center'>$r->email</td></p>
> ;";"></a> and it stopped the email from
> showing in the table.

That's invalid HTML. You can't have a table in the href-Attribute.

> CODE:
>
> case "xxx":
> // email vars
> $email = mysql_query("SELECT * FROM users WHERE
> username = 'xxx'");

Never fetch more columns than needed from the DB. Never use SELECT *, unless you really need all columns of a table. SELECT * is causing more network load than required (in other words it makes your scripts slow).


> ?>
> <div
> class="itemHead"><b>xxx</b></div
> >
> <br><br>
> <table border='1'>
> <tr>
> <td valign='top'
> align='center'><i><b><font
> size='2'>Name:</font></b></i>
> </td>
> <td valign='top'
> align='center'><i><b><font
> size='2'>Occupation:</font></b><
> /i></td>
> <td valign='top'
> align='center'><i><b><font
> size='2'>Email:</font></b></i>
> ;</td>
> </tr>
> <tr>
> <td valign='top' align='center'>
> <p align='center'>Giacomo </td>


*eeek* HTML parse error: not well-formed.

> <td valign='top'
> align='center'>Founder/Coder </td>
> <?php
>
> while ($r = mysql_fetch_object($email)) {
> echo "<td valign='top'
> align='center'>$r->email</td></p>

*eeek* Style warning: learn what htmlspecialchars() does.

Ulf

Options: ReplyQuote


Subject
Written By
Posted
January 13, 2006 02:37AM
Re: noob qestion
January 13, 2006 12:49PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.