Using <a href> in a database

I am wondering if it is possible to use a href link with in a database file. For example - index.php has content from Page 1, which comes from the ‘content’ of the database table. With in this data is a link to another page, via id maybe. The index page will have the php code to display the table fields, header and content. So the content on the database table could look something like this:

header some same
content this person is related to <a href="index.php?id=1>Some one

I don’t want to attempt this if it will not work. All other links, such as menu will ideally link to index.php.

Well, yes, that is how most websites are created these days. Links pointing to website pages.

You just show the link in HTML like this, assuming you already have your row of data from your database query to get the location of the link…

<a href="<?PHP echo $row['link']; ?>">Some-One</a>

Of course, you use a link-name also instead of the some-one, you would place the text in the DB, too.
Do you understand that?

It will work, but doing a template may be the better option? It’s like having a master style guide that defines what the pages will look like and only populating what needs to be populated.

Sponsor our Newsletter | Privacy Policy | Terms of Service