You are here Support Forums
Search:  
Replace a variable in an HREF (on the page not the URL) with a DB value
Last Post 28 Jan 2005 10:22 AM by Jack Swaton. 1 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Jack Swaton
New Member
New Member
Posts:1

--
28 Jan 2005 10:22 AM  

So far I love this module. Thanks to Midspot for the recommendation. In 10 seconds I have created a useful query that took me 30 minutes in a "pro" package.

Here's what I'm trying to do. I need to present a user with an astronomy weather clock that is customed to each user and persist between visits. So then, I have a SQL table (ClearSkyClock)with three columns: state_or_province, clockid, title (all text cols). I have to let the user select which clock they want (perhaps by progressive dropdowns) and then store that in a table with their UserID and ClockID (that they just selected).

Next when the user calls up the page, I need to automatically pull the ClockID based on the User viewing the page and and insert the ClockID into the following HREF (replace the variable "{$clockid}":

<a href=http://cleardarksky.com/c/{$clockid}key.html>

<img src="http://cleardarksky.com/csk/getcsk.php?id={$clockid}"></a>

This will present the user with their very own astronomy weather clock.

Richard Edwards
DNNStuff Founder
Veteran Member
Veteran Member
Posts:1207
Avatar

--
29 Jan 2005 03:10 PM  

Hi Jack,

With the current SQLView module, there is no support for prompting for data and putting it into the database. If you manage to get that data into the database and associate it with a userid then it's quite simple to produce the url you mentioned. Something like this should work:

select '<a href=http://cleardarksky.com/c/' + CAST(ClockId as varchar) + 'key.html><img src=http://cleardarksky.com/csk/getcsk.php?id=' + CAST(ClockId as varchar) + '></a>' from ClearSkyClock

Of course this will give you a page full of links. If you can figure out a way to store the user's selected clock in the database and associate that with their userid, you can use this information with an inner join to just select the single clock they require.

Hope this helps.



Richard Edwards
DNNStuff Founder
Did you receive excellent support? Consider leaving a testimonial
You are not authorized to post a reply.

Active Forums 4.1
Privacy StatementTerms Of UseCopyright (c) 2004-2012 DNNStuff