Re: Fetch Information Via a link
| From: | Eric Holmstrom | Date: | Mon, 22 Dec 2003 21:28:35 +0000 |
| Subject: | Re: Fetch Information Via a link | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-173202@lists.php.net to get a copy of this message | ||
Thankyou, put me on the right track :)
"Jasper Bryant-Greene" <jasp@fatalnetwork.com> wrote in message
news:20031222060724.66546.qmail@pb1.pair.com...
> Hi Eric
>
> What you need to do is make another PHP page, maybe info.php, which will
> fetch the info field from the DB and display it.
>
> So for example, assuming the eventname field is unique, you could make
> the info like something like:
>
> <a
> href="info.php?eventname=<?=urlencode($eventname)?>">information</a>
>
> And then make info.php fetch the info field from the DB, for example if
> you were using MySQL:
>
> // page header HTML here
> <?
> $row = mysql_fetch_assoc(mysql_query("SELECT info FROM table WHERE
> eventname='{$_GET['eventname']}'"));
> $info = $row['info'];
> print(nl2br($info));
> ?>
> // page footer HTML here
>
> Obviously you will need to change that to suit your site, and you may
> want to add some security to the $_GET variable being passed to the
> MySQL server to prevent attacks. Other than that, hope this helps.
>
> Regards
>
> Jasper Bryant-Greene
> Cabbage Promotions
> http://fatalnetwork.com/
> jasp@fatalnetwork.com
>
>
> Eric Holmstrom wrote:
>
> > Hi there,
> >
> > I have this.
> > Table Name = events
> > Fields = eventname, date, info. Example
> >
> > -------------------------------
> > EVENTS
> > -------------------------------
> > eventname | date | info
> > ------------------------------
> > event1 | 0202 | info here
> > ------------------------------
> > event2 | 0303 | info here 2
> >
> > The problem is that the field "info" has alot of text in it. When I
print
> > this out in an array it makes a huge page due to each event having alot
of
> > information. So im trying to make it so it will display the results like
> > this.
> >
> > event1 0202 infomation
> > event2 0303 infomation
> >
> > I want the word "infomation" to be hyperlinked, so if you click on it,
it
> > will display the information in the "info" field. The problem is I don't
> > know how to make a hyperlink that grabs the correct infomation for each
> > event.
> >
> > Any help at all will be very grateful for.
> >
> > Thankyou
> >
> > Eric Holmstrom