MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old March 30th, 2004, 04:56 PM
JY11 JY11 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 8 JY11 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question using links stored in MYSQL DB

I have a PHP page that allows a user, through a form, to post information to a MYSQL database. One of these fields is a url to another page. However when i try to display the record in this table on another page i cannot get the url to work. When this page is loaded i go through my DB and put all the fields into variables for each record. I then use an echo statement to display the variables in a table. I have the url in a variable called $site and I then try to display this link with the following:
<a href ="$site">Click here</a> This however gets me an error saying: Parse error: parse error, unexpected T_VARIABLE, expecting ',' or ';' . I would appreciate any help on this matter that anyone can give me, i'm sure there is probably a very simple solution but as a new user of PHP i just can't seem to find it. Here is the code for this section of my page: Thank you again.
PHP Code:
//go through each row and display data
  
while ($newarray mysql_fetch_array($result))
    {
      
$id $newarray['id'];
      
$est_name $newarray['est_name'];
      
$address $newarray['est_address'];
      
$menu $newarray['est_menu'];
      
$site $newarray['est_site'];
      
$pic $newarray['est_pic'];
      if (
$newarray['est_pic'] == "")      
        {      
     
      echo 
"<table><tr>
            
            <td>
                name: $est_name<br><br>
                Address: $address<br>
            </td>
            <td>
                   <strong>Menu:</strong>$menu<br>
                   <strong>Website:</strong><a href ="
$site">Click here</a>
                               </td>
            </tr>
            </table>
                <HR WIDTH ='70%' ALIGN ='left'>           
            "
;

        } 

Reply With Quote
  #2  
Old March 31st, 2004, 07:45 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
You can't nest quotes. Or you can, but you have to escape them with backslashes. Where you've got <a href="$site">, try <a href=\"$site\">.
__________________
Please don't PM me asking for solutions outside the scope of a thread.
Keeping all responses in a thread stands to help others who come along later,
which is after all what this forum's all about.

Reply With Quote
  #3  
Old March 31st, 2004, 01:34 PM
JY11 JY11 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 8 JY11 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks so much, it worked perfectly. I knew it was going to be something like that where i was close but missing something important.

Reply With Quote
  #4  
Old March 31st, 2004, 04:10 PM
Pheifel Pheifel is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: Denmark
Posts: 174 Pheifel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 43 m 46 sec
Reputation Power: 5
Send a message via MSN to Pheifel
gennerally, when opperating with the ancor-tag <a/> then you should try to use single qoutations only. ei. <a href='link'>test</a>

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > using links stored in MYSQL DB


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway