Re: php newbie having trouble going to detail page

From: Date: Sat, 08 Apr 2006 16:55:10 +0000
Subject: Re: php newbie having trouble going to detail page
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-233564@lists.php.net to get a copy of this message
David Doonan wrote:
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
David-- Note that your request URL has a value for 'ID' whereas your program is looking for a value for 'recordID'. Try displaying your SQL query on the output page. I have a hunch it'll say Author.ID = '' --John

« previous php.general (#233564) next »