Using php in a MySQL query

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
se
Forum Newbie
Posts: 2
Joined: Mon Nov 24, 2003 9:37 am

Using php in a MySQL query

Post by se »

:? What do I have to do in order to get the $title field in to be used as the link to a page?

For inst: echo "<TD><a href=\"../no1.php?id=".$myrow[id]."\">View</a> ";

Instead of "view" I would like to use the .$myrow[title]
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Try this (single quotes instead of double mean you don't need all the ''s):

Code: Select all

echo '<TD><a href="../no1.php?id='.$myrow['id'].'">'.$myrow['title'].'</a>';
also have a read of the second link in my signature for why you should use $myrow['id'] instead of $myrow[id].

Mac
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

think it should be like this

Code: Select all

echo "<TD><a href="../no1.php?id=".$myrow['id']."">".$myrow['title']."</a> ";
Mark
se
Forum Newbie
Posts: 2
Joined: Mon Nov 24, 2003 9:37 am

Post by se »

:D Thanks to both of you
Post Reply