[PHP] newbie question
I'm developing my first php mysql site and have hit a stumbling block regarding how text is being returned out of the database. This is the code that I'm using on the display page. It is displaying the returned text as one long paragraph, instead of mulitiple paragraphs: --- This block of code is from the CMS edit page which is correctly displaying the text as multiple paragraphs: The only difference is the textarea tag from the form. What am I missing? I've looked through numerous books and dozens of web pages without finding anything that makes sense to me. Lots of references to n12br which I have no idea how to implement. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie question
Writings_Text is the field in the d/b that contains the text I'm trying to return. I've done a couple of dozen ColdFusion sites and would format like this: #ParagraphFormat(Writings_Text)# and the results would be retuned exactly as stored in the d/b. What I'm searching for is the php equilevant of the above. Please bear in mind that this is my first php site and my background is in fine art, not programming. david On Apr 5, 2006, at 11:41 AM, Jay Blanchard wrote: [snip] Read this http://www.php.net/nl2br The page stops writing once it hits this line: [/snip] And? What is the content of 'Writings Text'? Is there anything there? [helpful hint] When responding to e-mails on the list you must hit replay all or the list will never see the response and therefore cannot continue to help. If you respond directly to someone who answers your question they may no longer be there or you e-mail may go directly to the spam folder since it would not be recognized. [/helpful hint] Oh: Text only. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie question
On Apr 5, 2006, at 11:51 AM, Evan Priestley wrote: On Apr 5, 2006, at 11:41 AM, Jay Blanchard wrote: ^ Not sure if this is just a transcription error, but that should be an 'l' (ell), not a '1' (one) in "nl2br". Evan Grazi! Exactly what I'm looking for! a very grateful newbie! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php newbie having trouble going to detail page
I'm having trouble getting the correct results on a display page. The first query is pulling the name of active authors from the d/b and sending a request to only return essay titles by the requested author. The list page however is displaying essay titles by all authors. No doubt something is wrong with the where clause in the List page query. I've tried countless variations on the syntax for Author.ID = Author.ID without success. Sorry for so basic a question. - author page query = $query_GetAuthors = "SELECT Distinct Author.Autholr_Name, Author.ID, Writings.Writings_Author FROM Author, Writings WHERE Author.Autholr_Name = Writings.Writings_Author and Author.ID = Author.ID"; $GetAuthors = mysql_query($query_GetAuthors, $connDerbyTrail) or die (mysql_error()); $row_GetAuthors = mysql_fetch_assoc($GetAuthors); $totalRows_GetAuthors = mysql_num_rows($GetAuthors); author page link = echo $row_GetAuthors['Autholr_Name']; ?> - List page query = $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 Writings.ID = Writings.ID AND Author.Autholr_Name = Writings.Writings_Author AND Author.ID = Author.ID ORDER BY Writings.Writings_Date desc"; $GetAuthorList = mysql_query($query_GetAuthorList, $connDerbyTrail) or die(mysql_error()); $row_GetAuthorList = mysql_fetch_assoc($GetAuthorList); $totalRows_GetAuthorList = mysql_num_rows($GetAuthorList); david -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php newbie having trouble going to list page
I'm having trouble getting the correct results on a list page. The first query is pulling the name of active authors from the d/b and linking to a list page that is supposed to return essay titles by the requested author. The list page however is displaying essay titles by all authors. No doubt something is wrong with the where clause in the List page query. I've tried countless variations on the syntax for Author.ID = Author.ID without success. Sorry for so basic a question. - author page query = $query_GetAuthors = "SELECT Distinct Author.Autholr_Name, Author.ID, Writings.Writings_Author FROM Author, Writings WHERE Author.Autholr_Name = Writings.Writings_Author and Author.ID = Author.ID"; $GetAuthors = mysql_query($query_GetAuthors, $connDerbyTrail) or die (mysql_error()); $row_GetAuthors = mysql_fetch_assoc($GetAuthors); $totalRows_GetAuthors = mysql_num_rows($GetAuthors); author page link = echo $row_GetAuthors['Autholr_Name']; ?> - List page query = $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 Writings.ID = Writings.ID AND Author.Autholr_Name = Writings.Writings_Author AND Author.ID = Author.ID ORDER BY Writings.Writings_Date desc"; $GetAuthorList = mysql_query($query_GetAuthorList, $connDerbyTrail) or die(mysql_error()); $row_GetAuthorList = mysql_fetch_assoc($GetAuthorList); $totalRows_GetAuthorList = mysql_num_rows($GetAuthorList); david -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php newbie having trouble going to detail page
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
Re: [PHP] php newbie having trouble going to detail page
On Apr 8, 2006, at 12:55 PM, John Hicks wrote: $recordID = $_GET['recordID']; Note that your request URL has a value for 'ID' whereas your program is looking for a value for 'recordID'. Changed above to: $recordID = $_GET['ID']; And all was right with the world. Thanks John! david -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Record ID not being recognized
While I am by no strech of the imagination a ColdFusion expert, I have built a couple of dozen CF sites over the past 5 years. Am currently working on my first PHP site and am running into a problem with the simplest little thing. An index page is returning a list of active category names. Each name is a link to a thumbnails page. The photos on the thumbnails page are links to a display page which displays the enlarged photo and additional text. My problem is in getting the thumbnails page to only display the images associated with the category name selected on the index page. Either the thumbnail page displays ALL images or it displays none. Below is the query on the thumbnail page, which is currently returning no records. If I replace '$recordcatID' with the specific name of a category, the correct records are returned. Likewise, if I remove the WHERE statement, all records are returned. So obviously something is wrong with the sql statement. But I can't help but feel that I'm missing something in the PHP syntax. $query_GetThumbs = "SELECT Photos.Photos_ImagePath, Photos.Photos_Title, Photos.ID, Photos.Photo_Category, Photos_Category.Category_Name, Photos_Category.catID FROM Photos, Photos_Category WHERE Photos_Category.catID = '$recordcatID' AND Photos_Category.Category_Name = Photos.Photo_Category"; $GetThumbs = mysql_query($query_GetThumbs, $connTrail) or die (mysql_error()); $row_GetThumbs = mysql_fetch_assoc($GetThumbs); $totalRows_GetThumbs = mysql_num_rows($GetThumbs); ?> The link from the index page to the thumbnails page is carrying the catID number forward, as seen in the resulting URL (thumbs.php? ID=17), yet the query isn't accepting it. table Photos_Category contains the category names. table Photos contains the photos and other relevant information. Any ideas where I'm going wrong? david -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Record ID not being recognized
On May 9, 2006, at 3:27 PM, Wolf wrote: $recordcatID = $_GET[ID]; //place before the query Grazi! da