Joomla! Discussion Forums



It is currently Fri Nov 27, 2009 4:55 pm (All times are UTC )

 




Post new topic Reply to topic  [ 4 posts ] 
Author Message
Posted: Thu Nov 05, 2009 10:14 pm 
User avatar
Joomla! Intern
Joomla! Intern
Offline

Joined: Sat Dec 16, 2006 10:34 am
Posts: 51
Location: Summerside, PEI
I'm turning to this forum once again as this forum has helped me learn a great deal.

I'm hoping that it is possible to pull data from a table and link to it. In short, I simply need to be able to pull a field from the database and insert it into a web link.

Here is the link and the 'link_id' is where I want the code to pull the data from. The tables are linked correctly as I can display the link_id in the table. The only problem I'm having is creating the link.

Code:
echo "<td><a href='index.php?option=com_mtree&task=viewlink&link_id='".$row['link_id']." target='new'>" . $row['link_name'] . "</a>";


So, to be clear, my site uses the same first part of the link and the only difference is the link_id. I can get the first part of the link to appear by using this code but I can't get the link_id number to show up in the link.

Any help, much appreciated.

Ken


Last edited by bikingforbreakfast on Fri Nov 06, 2009 6:36 pm, edited 1 time in total.

Top
  E-mail  
 
Posted: Fri Nov 06, 2009 12:35 am 
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Mon Aug 11, 2008 1:16 am
Posts: 312
Assuming that you assigned the reference in the view;
just try adding a $this pointer to retrieve it.

Code:
$this->row['link_name']


Top
  E-mail  
 
Posted: Fri Nov 06, 2009 2:06 am 
User avatar
Joomla! Intern
Joomla! Intern
Offline

Joined: Sat Dec 16, 2006 10:34 am
Posts: 51
Location: Summerside, PEI
Thanks so much...

Could you help me walk through this a little. How do I assign a reference in the view?

I'm a novice in PHP but I'm a quick learner.

Thanks so much,

Ken


Top
  E-mail  
 
Posted: Fri Nov 06, 2009 6:35 pm 
User avatar
Joomla! Intern
Joomla! Intern
Offline

Joined: Sat Dec 16, 2006 10:34 am
Posts: 51
Location: Summerside, PEI
I almost hate to write this but I think I have figured it out...

Here is the new code that now generates the appropriate link_id from the table:
Code:
echo "<td><a href='/index.php?option=com_mtree&task=viewlink&link_id=" . $row['link_id'] . "'>" . $row['link_name'] . "</a></td>";


It 'appears' the target="new" code was creating an error. I removed the target and it seems to be working AWESOME now.

Thought I'd let everyone know if you too are experiencing this problem.

Ken


Top
  E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

Quick reply

 



Who is online

Users browsing this forum: Mike Cantwell and 25 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group