Connecting Tech Pros Worldwide Help | Site Map

click a hyperlink to query MYSQL w/PHP - how?

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 09:20 AM
leegold2
Guest
 
Posts: n/a
Default click a hyperlink to query MYSQL w/PHP - how?

Like so many questions this involves MYSQL and the PHP (or Perl) layer.

I'm going to have html in text fields and there's going to be what
normally would be an internal link to another place in the same
document. But in this case,
Code:

<a href="#futherdown">next title</a>

is not in the html document. When a user clicks this link I want to
query the DB and append/render the queried record on the I guess
existing (refreshed) page. What's a strategy to make a hyperlink query
via PHP?

I'm trying to make internal links work "normally" on dynamic page if you
get my drift,
Lee G.

  #2  
Old July 17th, 2005, 09:20 AM
Daniel Tryba
Guest
 
Posts: n/a
Default Re: click a hyperlink to query MYSQL w/PHP - how?

leegold2 <leegold@nospam.net> wrote:[color=blue]
> <a href="#futherdown">next title</a>
>
> is not in the html document. When a user clicks this link I want to
> query the DB and append/render the queried record on the I guess
> existing (refreshed) page. What's a strategy to make a hyperlink query
> via PHP?
>
> I'm trying to make internal links work "normally" on dynamic page if you
> get my drift,[/color]

This is a clientside issue, so you need clientside tech to accomplish
what you want. The above link in that form is quite useless, use
javascript instead. The main problem is that if the anchor is within the
current URL the browser will not make a request to the server.

--

Daniel Tryba

  #3  
Old July 17th, 2005, 09:20 AM
Chris Hope
Guest
 
Posts: n/a
Default Re: click a hyperlink to query MYSQL w/PHP - how?

leegold2 wrote:
[color=blue]
> Like so many questions this involves MYSQL and the PHP (or Perl) layer.
>
> I'm going to have html in text fields and there's going to be what
> normally would be an internal link to another place in the same
> document. But in this case,
> Code:
>
> <a href="#futherdown">next title</a>
>
> is not in the html document. When a user clicks this link I want to
> query the DB and append/render the queried record on the I guess
> existing (refreshed) page. What's a strategy to make a hyperlink query
> via PHP?
>
> I'm trying to make internal links work "normally" on dynamic page if you
> get my drift,[/color]

You cannot make internal #furtherdown type links on an HTML page do anything
other than move up and down a page which has already been rendered in the
browser.

You need to make a link back to the server, in your case back to the same
page, passing parameters which will get that information into the page eg
foo.php?show=3#section3 - the use of the #section3 bit here is to then jump
the browser down to the appropriate section once the page has loaded.

Another way to do this is a combination of Javascript and CSS (ie DHTML).
You have have all the required content in your page but hidden, and when
they click a link it makes the section you want appear. Of course this
won't work if they have Javascript disabled, or a using a browser that does
not support JS.

An example of this in action is at
http://www.woosh.com/UserInterface/W...erSupport.aspx

Click the little down arrow links to the left of the questions and the
answer appears underneath. Click it again and it disappears.

If the above link is broken in your newsreader use this tinyurl instead
http://tinyurl.com/3qxgt

--
Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/
  #4  
Old July 17th, 2005, 09:20 AM
leegold2
Guest
 
Posts: n/a
Default Re: click a hyperlink to query MYSQL w/PHP - how?

Chris Hope wrote:[color=blue]
> leegold2 wrote:
>
>[/color]
......snip...[color=blue]
>
> You cannot make internal #furtherdown type links on an HTML page do anything
> other than move up and down a page which has already been rendered in the
> browser.
>
> You need to make a link back to the server, in your case back to the same
> page, passing parameters which will get that information into the page eg
> foo.php?show=3#section3 - the use of the #section3 bit here is to then jump
> the browser down to the appropriate section once the page has loaded.[/color]

Yes, thanks. That's what I'm going to do. I just learned a lot!

.....snip...
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.