Re: Need a hint on how to display mysql field as a link to a query
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Sat, 12 Apr 2008 21:35:34 -0400
Larry C wrote:
"Larry C" <lccronin@xxxxxxxxxxx> wrote in message news:jdtLj.10586$qB1.7181@xxxxxxxxxxx> Hello,"Embedded Link" was the term I should have been searching for
Thanks Again
Larry C
"Larry C" <lccronin@xxxxxxxxxxx> wrote in message news:2S9Lj.4231$3w2.1051@xxxxxxxxxxxThank you very much
I can work with that and figure it all out.
Larry C
"Floortje" <none@xxxxxxxxx> wrote in message news:47fd2861$0$53214$dbd4b001@xxxxxxxxxxxxxxxxxxLarry C schreef:Hello,
Hoping someone can point me in the correct direction. My Google searches are just getting me to many hits.
I have a database for a golf league. I want to display the names of the members but have the name be a link to there own page. I could "hard code" the page but I wanted to have the same option under the page for standings which will vary week to week.
index.php
$sql = "SELECT * FROM MEMBERS";
foreach($db->q($sql) as $member){
echo '<a href="members.php?memberId='.$members['memberId'].'">'.$member['name'].'</a>'
}
members.php
$sql = "SELECT * FROM members WHERE memberId = '.intval($_GET['memberId']).'";
if($db->q($sql)){
// display contents
}
note: change the $db->q() stuff to whatever you would like to use for conecting to the database.
Could someone just point me to a site that could explain it a bit. I need to learn how to do it because I think I want to do something similar with our schedule page.
Thanks
Larry C
>
> I need a bit more help.
>
> What you showed me works great. My issue now is I cant display both the
> firstname and lastname of the golfer.
>
> I would like to show both first and last as one link to another page.
>
> My code:
>
> $firstname = $row[0];
> $lastname = $row[1];
>
> echo '<a href="member.php?lastname='.$lastname.'">'.$lastname.'</a>' ;
>
>
> Thanks
>
> Larry C
>
>
First of all, how do you identify the golfer? That's what needs to go into the link.
You can display both first name and last name with no problem. The link to page isn't necessarily the same as what is displayed.
For instance - you could have:
<a href="http://www.example.com/score.php?golfer=3">Tiger Woods</a><br>
<a href="http://www.example.com/score.php?golfer=15">Ernie Els</a>
The fist link will display "Tiger Woods" but will link to www.example.com/score.php and pass the parameter "golfer=3". The second one will display "Ernie Els" but link to the same page with golfer=15.
You really need to study up on basic HTML. These aren't really PHP questions (although the links are generated by PHP) but *very basic* html.
P.S. Please don't top post. Thanks.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.
- Follow-Ups:
- References:
- Need a hint on how to display mysql field as a link to a query
- From: Larry C
- Re: Need a hint on how to display mysql field as a link to a query
- From: Floortje
- Re: Need a hint on how to display mysql field as a link to a query
- From: Larry C
- Re: Need a hint on how to display mysql field as a link to a query
- From: Larry C
- Re: Need a hint on how to display mysql field as a link to a query
- From: Larry C
- Need a hint on how to display mysql field as a link to a query
- Prev by Date: Re: Need a hint on how to display mysql field as a link to a query
- Next by Date: Persisting objects over application lifetime (without serialization)
- Previous by thread: Re: Need a hint on how to display mysql field as a link to a query
- Next by thread: Re: Need a hint on how to display mysql field as a link to a query
- Index(es):
Relevant Pages
|