Need a hint on how to display mysql field as a link to a query
Need a hint on how to display mysql field as a link to a query
am 09.04.2008 20:48:54 von L C
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.
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
Re: Need a hint on how to display mysql field as a link to a query
am 09.04.2008 22:34:41 von patrick finger
Larry 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 '
href="members.php?memberId='.$members['memberId'].'">'.$memb er['name'].''
}
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
Re: Need a hint on how to display mysql field as a link to a query
am 09.04.2008 22:41:34 von L C
Thank you very much
I can work with that and figure it all out.
Larry C
"Floortje" wrote in message
news:47fd2861$0$53214$dbd4b001@news.wanadoo.nl...
> Larry 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 '
> href="members.php?memberId='.$members['memberId'].'">'.$memb er['name'].''
> }
>
>
> 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
Re: Need a hint on how to display mysql field as a link to a query
am 10.04.2008 20:43:27 von L C
"Embedded Link" was the term I should have been searching for
Thanks Again
Larry C
"Larry C" wrote in message
news:2S9Lj.4231$3w2.1051@trnddc05...
> Thank you very much
>
> I can work with that and figure it all out.
>
> Larry C
>
>
>
> "Floortje" wrote in message
> news:47fd2861$0$53214$dbd4b001@news.wanadoo.nl...
>> Larry 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 '
>> href="members.php?memberId='.$members['memberId'].'">'.$memb er['name'].''
>> }
>>
>>
>> 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
>
Re: Need a hint on how to display mysql field as a link to a query
am 12.04.2008 22:22:17 von L C
Hello,
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 '' ;
Thanks
Larry C
"Larry C" wrote in message
news:jdtLj.10586$qB1.7181@trnddc07...
> "Embedded Link" was the term I should have been searching for
>
> Thanks Again
>
> Larry C
>
>
> "Larry C" wrote in message
> news:2S9Lj.4231$3w2.1051@trnddc05...
>> Thank you very much
>>
>> I can work with that and figure it all out.
>>
>> Larry C
>>
>>
>>
>> "Floortje" wrote in message
>> news:47fd2861$0$53214$dbd4b001@news.wanadoo.nl...
>>> Larry 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 '
>>> href="members.php?memberId='.$members['memberId'].'">'.$memb er['name'].''
>>> }
>>>
>>>
>>> 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
>>
>
Re: Need a hint on how to display mysql field as a link to a query
am 13.04.2008 03:35:34 von Jerry Stuckle
Larry C wrote:
> "Larry C" wrote in message
> news:jdtLj.10586$qB1.7181@trnddc07...
>> "Embedded Link" was the term I should have been searching for
>>
>> Thanks Again
>>
>> Larry C
>>
>>
>> "Larry C" wrote in message
>> news:2S9Lj.4231$3w2.1051@trnddc05...
>>> Thank you very much
>>>
>>> I can work with that and figure it all out.
>>>
>>> Larry C
>>>
>>>
>>>
>>> "Floortje" wrote in message
>>> news:47fd2861$0$53214$dbd4b001@news.wanadoo.nl...
>>>> Larry 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 '
>>>> href="members.php?memberId='.$members['memberId'].'">'.$memb er['name'].''
>>>>
>>>> }
>>>>
>>>>
>>>> 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
>>>
>>
>
>
> Hello,
>
> 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 '' ;
>
>
> 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:
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@attglobal.net
==================
Re: Need a hint on how to display mysql field as a link to a query
am 13.04.2008 17:16:09 von L C
"Jerry Stuckle" wrote in message
news:oaqdnSK80Ov0_5zVnZ2dnUVZ_hisnZ2d@comcast.com...
> Larry C wrote:
>> "Larry C" wrote in message
>> news:jdtLj.10586$qB1.7181@trnddc07...
>>> "Embedded Link" was the term I should have been searching for
>>>
>>> Thanks Again
>>>
>>> Larry C
>>>
>>>
>>> "Larry C" wrote in message
>>> news:2S9Lj.4231$3w2.1051@trnddc05...
>>>> Thank you very much
>>>>
>>>> I can work with that and figure it all out.
>>>>
>>>> Larry C
>>>>
>>>>
>>>>
>>>> "Floortje" wrote in message
>>>> news:47fd2861$0$53214$dbd4b001@news.wanadoo.nl...
>>>>> Larry 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 '
>>>>> href="members.php?memberId='.$members['memberId'].'">'.$memb er['name'].''
>>>>> }
>>>>>
>>>>>
>>>>> 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
>>>>
>>>
>>
>> Hello,
> >
> > 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 '' ;
> >
> >
> > 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:
>
>
>
>
> 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@attglobal.net
> ==================
>
Jerry,
I am identifying the golfer by their lastname. I also want to display the
golfers firstname and lastname on the page. I am getting the names of the
golfers from a database.
I am not sure how your answer helps me.
Larry C
Re: Need a hint on how to display mysql field as a link to a query
am 13.04.2008 22:18:47 von Jerry Stuckle
Larry C wrote:
>
> "Jerry Stuckle" wrote in message
> news:oaqdnSK80Ov0_5zVnZ2dnUVZ_hisnZ2d@comcast.com...
>> Larry C wrote:
>>> "Larry C" wrote in message
>>> news:jdtLj.10586$qB1.7181@trnddc07...
>>>> "Embedded Link" was the term I should have been searching for
>>>>
>>>> Thanks Again
>>>>
>>>> Larry C
>>>>
>>>>
>>>> "Larry C" wrote in message
>>>> news:2S9Lj.4231$3w2.1051@trnddc05...
>>>>> Thank you very much
>>>>>
>>>>> I can work with that and figure it all out.
>>>>>
>>>>> Larry C
>>>>>
>>>>>
>>>>>
>>>>> "Floortje" wrote in message
>>>>> news:47fd2861$0$53214$dbd4b001@news.wanadoo.nl...
>>>>>> Larry 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 '
>>>>>> href="members.php?memberId='.$members['memberId'].'">'.$memb er['name'].''
>>>>>>
>>>>>> }
>>>>>>
>>>>>>
>>>>>> 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
>>>>>
>>>>
>>>
>>> Hello,
>> >
>> > 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 '' ;
>> >
>> >
>> > 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:
>>
>>
>>
>>
>> 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@attglobal.net
>> ==================
>>
>
> Jerry,
>
> I am identifying the golfer by their lastname. I also want to display
> the golfers firstname and lastname on the page. I am getting the names
> of the golfers from a database.
>
> I am not sure how your answer helps me.
>
> Larry C
>
>
First of all, you probably shouldn't be identifying the golfer by his
last name - what happens if you have a John Smith and a Joe Smith? Or
even worse, two John Smith's? Rather, you should have a unique id in
the database for each golfer.
But my point above still stands. The parameter you're passing in the
link is what will be used to access the data. But what the user sees
can be different. Think if the number of times you've seen a "click
here" or similar link, which doesn't have anything related to the link
itself being displayed.
So in the text itself, you put both the first and last names of the
golfer. But in the link you put just the last name, similar to what I
showed you above.
The code I showed you before displays "Tiger Woods", but the link will
be to "www.example.com/score.php?golfer=3". All you need to do is
replace the "3" with "Woods" and you'll pass the last name onto the new
page.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Re: Need a hint on how to display mysql field as a link to a query
am 13.04.2008 22:27:15 von L C
"Larry C" wrote in message
news:ZspMj.7202$Q53.4102@trnddc08...
>
> "Jerry Stuckle" wrote in message
> news:oaqdnSK80Ov0_5zVnZ2dnUVZ_hisnZ2d@comcast.com...
>> Larry C wrote:
>>> "Larry C" wrote in message
>>> news:jdtLj.10586$qB1.7181@trnddc07...
>>>> "Embedded Link" was the term I should have been searching for
>>>>
>>>> Thanks Again
>>>>
>>>> Larry C
>>>>
>>>>
>>>> "Larry C" wrote in message
>>>> news:2S9Lj.4231$3w2.1051@trnddc05...
>>>>> Thank you very much
>>>>>
>>>>> I can work with that and figure it all out.
>>>>>
>>>>> Larry C
>>>>>
>>>>>
>>>>>
>>>>> "Floortje" wrote in message
>>>>> news:47fd2861$0$53214$dbd4b001@news.wanadoo.nl...
>>>>>> Larry 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 '
>>>>>> href="members.php?memberId='.$members['memberId'].'">'.$memb er['name'].''
>>>>>> }
>>>>>>
>>>>>>
>>>>>> 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
>>>>>
>>>>
>>>
>>> Hello,
>> >
>> > 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 '' ;
>> >
>> >
>> > 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:
>>
>>
>>
>>
>> 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@attglobal.net
>> ==================
>>
>
> Jerry,
>
> I am identifying the golfer by their lastname. I also want to display the
> golfers firstname and lastname on the page. I am getting the names of the
> golfers from a database.
>
> I am not sure how your answer helps me.
>
> Larry C
>
I figured it out. I had the wrong combination of double quotes, quotes,
periods, etc. I started the statement from scratch and got it to work.
echo '
href="member.php?lastname='.$lastname.'">'.$lastname.$firstn ame.'' ;
Thanks
Larry C
BTW
Jerry said:
"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."
Jerry you are the one who needs to study *very basic* html. My questioned
contained variables. I am not a self proclaimed expert like you but *very
basic* html has no variables. It was absolutely a PHP based question.
When someone posts a question you have no idea who they are, what their
background is, how long they have looked at the screen and searched for an
answer only to get even more confused when a search returns about 10 million
hits. If you know the answer or can offer some direction, please do that.
The individual posting would appreciate it. If you think the person asking
is just looking for an easy way out, don't answer.
Don't be a dill weed and give a little remark like the person asking should
know the answer. It lessens the learning process for all and it makes you
look a fool.