Page 1 of 1

Using php in a MySQL query

Posted: Mon Nov 24, 2003 9:37 am
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]

Posted: Mon Nov 24, 2003 9:40 am
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

Posted: Mon Nov 24, 2003 9:42 am
by JayBird
think it should be like this

Code: Select all

echo "<TD><a href="../no1.php?id=".$myrow['id']."">".$myrow['title']."</a> ";
Mark

Posted: Mon Nov 24, 2003 2:36 pm
by se
:D Thanks to both of you