RE: [PHP] Noob question: Making search results clickable.
| From: | Ford, Mike | Date: | Thu, 19 Nov 2009 17:02:53 +0000 |
| Subject: | RE: [PHP] Noob question: Making search results clickable. | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-299938@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Nisse Engström [mailto:news.NOSPAM.0ixbtqKe@luden.se]
> Sent: 19 November 2009 14:54
> To: php-general@lists.php.net
> Subject: Re: [PHP] Noob question: Making search results clickable.
>
> On Wed, 18 Nov 2009 10:31:59 -0500, Paul M Foster wrote:
>
> > Replace your query with:
> >
> > "SELECT title, id FROM videos WHERE topid1 = '$topic'"
> >
> > or whatever index you have to select a particular video from your
> table.
> >
> > Replace your echo statement above with:
> >
> > echo "<a
> href="video_display.php?video_id=$row[id]">$row[title]</a>";
>
> Without actually checking, I don't think "$row[...]"
> is going to work in double quoted strings. I'm pretty
> sure it needs to be in braces. You also need to escape
> the double quotes and put the array indexes in single
> quotes:
You should have checked, because "...$row[title]..." is a valid alternative for
"...{$row['title']}...".
Personally, I never use it because of it not having the same meaning outside a double-quoted string
-- but it is a documented feature.
Cheers!
Mike
--
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,
Leeds Metropolitan University, C507, Civic Quarter Campus,
Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom
Email: m.ford@leedsmet.ac.uk
Tel: +44 113 812 4730
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm