Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hello, This one is probably easy 1

Status
Not open for further replies.

BDNFLNC

Technical User
May 30, 2002
202
US
Hello,

This one is probably easy for a season php-er...but I am a total novice. I have been charged with making this work.

I have an existing database and all else seem to be working fine. The following coding works well IF I don't have the "a href" parts in there.

Can someone steer me in the right direction and help me get the links working right? It is self-explanatory what I am trying to do by looking at my code...but I just don't know enough to get it working right.

I would appreciate any help!


-------code------

<?
$db_name= &quot;heinzchapel&quot;;
$table_name= &quot;vender&quot;;
$connection = @mysql_connect(&quot;localhost&quot;,&quot;bart&quot;,&quot;bart&quot;)
or die (&quot;Cannot get a connection&quot;);

$db= @mysql_select_db($db_name, $connection)
or die (&quot;Cannot get an connection&quot;);

$sql= &quot;Select vendername,address1,address2,city,state,zip,phone_num,emailaddress,url
From $table_name
where florist= 'YES'
order by vendername;&quot;;

$result =@mysql_query($sql,$connection) or die (&quot;Could not execute querey&quot;);

while ($row= mysql_fetch_array($result)) {
$vendername =$row ['vendername'];
$address1 = $row['address1'];
$address2 = $row['address2'];
$city = $row['city'];
$state = $row['state'];
$zip = $row['zip'];
$phone_num = $row['phone_num'];
$emailaddress = $row['emailaddress'];
$url = $row['url'];

$display_block .= &quot;
<p>
<b>$vendername</b><br>
$address1<br>
$address2<br>
$city, $state $zip<br>
<b>Phone:</b> $phone_num<br>
<b>eMail:</b> <a href='mailto:$emailaddress'>$emailaddress</a><br>
<b>On the Web:</b> <a href='</p>
&quot;;}

?>


-------more------

I KNOW the problem is in the following section:

$display_block .= &quot;
<p>
<b>$vendername</b><br>
$address1<br>
$address2<br>
$city, $state $zip<br>
<b>Phone:</b> $phone_num<br>
<b>eMail:</b> <a href=&quot;mailto:$emailaddress&quot;>$emailaddress</a><br>
<b>On the Web:</b> <a href=&quot;</p>
&quot;;}


Is it the quotations? Or maybe just the whole way I have the links written? It works fine without the <a href ...> in there. But I need those addresses to be links!

Thanks!


-----------------------------------------------
These are endless galaxies which are yours.
You can journey to infinity
through the endless passages of the cosmos.
Even better. This all belongs to you.
This is your mind.
 
Change
&quot;mailto:$emailaddress&quot;
to
\&quot;mailto:$emailaddress\&quot;

You're trying to put double quotes inside double quotes. You need to escape the interior quotes to make them output ______________________________________________________________________
Don't say thanks. Just award stars.
______________________________________________________________________
 
Worked like a charm! I knew it was simple...I was afraid to escape just the quotes. I was trying to escape the whole link. That really didn't do me any good.

Thanks for the assist!

I don't know how to award stars...but your help deserves one. Let me know how and I will get one going your way if I can.

Thanks again! -----------------------------------------------
These are endless galaxies which are yours.
You can journey to infinity
through the endless passages of the cosmos.
Even better. This all belongs to you.
This is your mind.
 
At the bottom left of each message posted to a thread, there is a link, the text of which reads, &quot;Click here to mark this post as a helpful or expert post!&quot;.

Clicking that link will tag the message's poster with a star in that thread. ______________________________________________________________________
Don't say thanks. Just award stars.
______________________________________________________________________
 
Awesome. Thanks again for the help.

Now I just need to figure out an if statement so that when the 'address2' field is empty it doesn't diplay a blank line. Should be simple enough.

Thanks again. -----------------------------------------------
These are endless galaxies which are yours.
You can journey to infinity
through the endless passages of the cosmos.
Even better. This all belongs to you.
This is your mind.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top