Re: php newbie having trouble going to detail page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Apr 8, 2006, at 11:24 AM, John Hicks wrote:

So your solution is this: Include a PHP variable in your SQL query to specify which author you want to select.

You probably want something like this:
WHERE
Author.Author_Name = Writings.Author_Name
AND
Author.ID = '$MySelectedAuthorID'

(but remember to define $MySelectedAuthorId before running it :)

John,

Taken your suggestion and added a variable, but the list page is now returning no records. The ID, which is showing up in the URL, is being passed from the first page to the list page (http://localhost/ Der/writings/author.php?ID=5) but the list page is not accepting that variable

New Query for list page=
mysql_select_db($database_connDer, $connDer);
$recordID = $_GET['recordID'];
$query_GetAuthorList = "SELECT Writings.Writings_Author, Writings.Writings_Title, DATE_FORMAT(Writings_Date, '%M %D, %Y') as Writings_Date, Writings.Writings_Text, Writings.ID, Author.Autholr_Name, Author.ID FROM Writings, Author
WHERE  Author.Autholr_Name = Writings.Writings_Author and
	   Author.ID = '$recordID'
ORDER BY Writings.Writings_Date desc";
$GetAuthorList = mysql_query($query_GetAuthorList, $connDerl) or die (mysql_error());
$row_GetAuthorList = mysql_fetch_assoc($GetAuthorList);
$totalRows_GetAuthorList = mysql_num_rows($GetAuthorList);

If this were a ColdFusion page, I would simply replace Author.ID = '$recordID' with ID = #ID#.

I'll take your suggestion and post in the PHP-DB list.

david

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux