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

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

Reply via email to