Re: [PHP] Pulling information out of a MySQL database

2001-11-26 Thread Douglas McKenzie

Im new to php but I would suggest using a pre/pre tag to wrap round your
text output. This should keep any formatting. I think.

Tim Thorburn wrote:

 Thanks to everyone for their help - especially Martin, that fixed my
 problem and now all the records (both basic and extended) display properly.

 I did have one last aesthetic question ... I have one field set as TEXT
 which holds descriptions of the events.  When the information was entered
 into this field, in many cases, spaces between lines were entered ...
 however, when I pull the info from the database onto the webpage ... all my
 line formatting is erased and its just one continuous line of text.  Is
 there a way to maintain my line formatting with spaces?

 Its not mission critical or anything ... just one of those things that
 would be nice.

 Thanks again
 -Tim

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Pulling information out of a MySQL database

2001-11-26 Thread Jon Haworth

You could look into the nl2br() function, which converts \n -style newlines
(entered in  TEXTAREAs) into HTML brs.

http://www.php.net/nl2br

HTH
Jon


-Original Message-
From: Tim Thorburn [mailto:[EMAIL PROTECTED]]
Sent: 26 November 2001 07:32
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Pulling information out of a MySQL database


I did have one last aesthetic question ... I have one field set as TEXT 
which holds descriptions of the events.  When the information was entered 
into this field, in many cases, spaces between lines were entered ... 
however, when I pull the info from the database onto the webpage ... all my 
line formatting is erased and its just one continuous line of text.  Is 
there a way to maintain my line formatting with spaces?


**
'The information included in this Email is of a confidential nature and is 
intended only for the addressee. If you are not the intended addressee, 
any disclosure, copying or distribution by you is prohibited and may be 
unlawful. Disclosure to any party other than the addressee, whether 
inadvertent or otherwise is not intended to waive privilege or confidentiality'

**

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Pulling information out of a MySQL database

2001-11-25 Thread Duncan Hill

On Sun, 25 Nov 2001, Tim Thorburn wrote:

 the proper information? My immediate thought is a cookie, but I have no 
 idea how to do this ... can anyone offer any other suggestions, or if a 
 cookie is the way to go - can someone point me in the right direction?

Hidden form variable, assign the previous values.

-- 

Sapere aude
My mind not only wanders, it sometimes leaves completely.
Never attribute to malice that which can be adequately explained by stupidity.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Pulling information out of a MySQL database

2001-11-25 Thread David Robley

On Mon, 26 Nov 2001 13:17, Tim Thorburn wrote:
 Hi,
 I'm having some new troubles pulling information out of a MySQL
 database. The page I'm currently working on has a simple form, that
 asks the user to select a month and year from two dropdown menu's then
 forwards their choices on to a new page which displays community events
 for the chosen month and year. This all works great.

 However, this new page that displays the community events along with
 their date allows the user to click on the name of the event for a more
 detailed list (location, time, description, etc) - this is the part
 that isn't working. The problem seems to be that the script forgets the
 previously chosen month and year when it goes to display the event in
 greater detail.

 How can I get the script to remember the month and year so it will
 display the proper information? My immediate thought is a cookie, but I
 have no idea how to do this ... can anyone offer any other suggestions,
 or if a cookie is the way to go - can someone point me in the right
 direction?

 The site is hosted on a Sun Solaris box with PHP 3.0.16 and MySQL
 3.23.31

 Thanks


Presumably each event will have a unique ID? Then pass that ID as part of 
the URL on the link for the detailed information, and use the ID to 
select the detailed information.

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   A cat is the universe's way of showing us perfection.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Pulling information out of a MySQL database

2001-11-25 Thread Tim Thorburn

Hi again,

Ok, I've heard some suggestions to my problem ... but I'm not entirely 
certain how to incorporate them, perhaps taking a look at the code would be 
helpful.

Again, the problem I'm having is as follows.  I have a simple form in which 
the user selects a month and year from two drop down menu's - based on 
their choice, the following PHP script searches a MySQL database and 
displays a basic listing (event name and date) for the selected 
month.  Then the user has the option to click an event name and receive a 
more detailed listing of the event - this is the portion that isn't working.

It seems that the script is forgetting the values entered by the user - I 
have come to this conclusion as when I replaced .$month. and .$year. 
with an actual month and year ie. 'November' and '2001' respectively, the 
detailed display works perfectly.

How can I get both the basic and detailed event listings working at the 
same time?

Thanks
-Tim


?

$db = mysql_connect(localhost, login, password);
mysql_select_db(edoinfo,$db);

if ($id) {

// query for extented information

$result = mysql_query(SELECT *, DATE_FORMAT(EventStartDate, '%W %M %D %Y') 
AS FormattedEventStartDate, DATE_FORMAT(EventEndDate, '%W %M %D %Y') AS 
FormattedEventEndDate, TIME_FORMAT(EventStartTime, '%r') AS 
FormattedEventStartTime, TIME_FORMAT(EventEndTime, '%r') AS 
FormattedEventEndTime FROM comcal WHERE id=$id and EventMonth='.$month.' 
and EventYear='.$year.',$db);

$myrow = mysql_fetch_array($result);

//display extended information

 echo table width='65%' border='0' cellspacing='2' cellpadding='2';
   echo tr;
 echo td valign='top' align='left'bEvent: /b/td;
 echo td valign='top' align='left';
echo ($myrow[EventName]);
echo /td;
   echo /tr;
   echo tr;
 echo td valign='top' align='left'bLocation: /b/td;
echo td valign='top' 
align='left'.($myrow[EventLocation])./td;
   echo /tr;
   echo tr;
echo td valign='top' align='left'bCity: /b/td;
echo td valign='top' align='left'.($myrow[EventCity])., 
.($myrow[EventState])./td;
   echo /tr;
   echo tr;
 echo td valign='top' align='left'bTime: /b/td;
echo td valign='top' 
align='left'.($myrow[FormattedEventStartTime])./td;
   echo /tr;
   echo tr;
 echo td valign='top' align='left'bDate: /b/td;
echo td valign='top' 
align='left'.($myrow[FormattedEventStartDate])./td;
   echo /tr;
   echo tr;
echo td valign='top' align='left'bContact Person(s): /b/td;
 echo td valign='top' align='left'.($myrow[EventC1FN]). 
.($myrow[EventC1LN]).br.($myrow[EventC2FN]). 
.($myrow[EventC2LN])./td;
   echo /tr;
   echo tr;
 echo td valign='top' align='left'bPhone: /b/td;
 echo td valign='top' 
align='left'.($myrow[EventC1ACPhone])...($myrow[EventC1ExcPhone])...($myrow[EventC1ExtPhone]).
 
;
echo 
br.($myrow[EventC2ACPhone])...($myrow[EventC2ExcPhone])...($myrow[EventC2ExtPhone]).
 
;
echo /td;
   echo /tr;
   echo tr;
echo td valign='top' align='left'bFax: /b/td;
 echo td valign='top' 
align='left'.($myrow[EventACFax])...($myrow[EventExcFax])...($myrow[EventExtFax])./td;
   echo /tr;
   echo tr;
echo td valign='top' align='left'bCell: /b/td;
 echo td valign='top' 
align='left'.($myrow[EventACCell])...($myrow[EventExcCell])...($myrow[EventExtCell])./td;
   echo /tr;
   echo tr;
echo td valign='top' align='left'bEmail: /b/td;
 echo td valign='top' align='left'a 
href='mailto:;.($myrow[EventEmail]).'.($myrow[EventEmail])./a/td;
   echo /tr;
   echo tr;
echo td valign='top' align='left'bWeb: /b/td;
 echo td valign='top' align='left'a 
href='.($myrow[EventWeb]).'.($myrow[EventWeb])./a/td;
   echo /tr;
   echo tr;
echo td valign='top' align='left'bDescription: /b/td;
 echo td valign='top' 
align='left'.($myrow[EventDescription])./td;
   echo /tr;
   echo tr;
echo td valign='top' align='left'bCost: /b/td;
 echo td valign='top' 
align='left'.($myrow[EventCost])./td;
   echo /tr;
   echo tr;
 echo td valign='top' align='left'b/b/td;
 echo td valign='top' align='left'nbsp;/td;
   echo /tr;
   echo tr;
 echo td valign='top' align='left'b/b/td;
 echo td valign='top' align='left'nbsp;/td;
   echo /tr;
 echo /table;


} else {

//display basic information from 

RE: [PHP] Pulling information out of a MySQL database

2001-11-25 Thread Martin Towell

If id is unique, you can change the first sql from:

$result = mysql_query(SELECT *, DATE_FORMAT(EventStartDate, '%W %M %D %Y') 
AS FormattedEventStartDate, DATE_FORMAT(EventEndDate, '%W %M %D %Y') AS 
FormattedEventEndDate, TIME_FORMAT(EventStartTime, '%r') AS 
FormattedEventStartTime, TIME_FORMAT(EventEndTime, '%r') AS 
FormattedEventEndTime FROM comcal WHERE id=$id and EventMonth='.$month.' 
and EventYear='.$year.',$db);

to:

$result = mysql_query(SELECT *, DATE_FORMAT(EventStartDate, '%W %M %D %Y') 
AS FormattedEventStartDate, DATE_FORMAT(EventEndDate, '%W %M %D %Y') AS 
FormattedEventEndDate, TIME_FORMAT(EventStartTime, '%r') AS 
FormattedEventStartTime, TIME_FORMAT(EventEndTime, '%r') AS 
FormattedEventEndTime FROM comcal WHERE id=$id,$db);

in other words: remove the month and year from the where clause

Martin


-Original Message-
From: Tim Thorburn [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 26, 2001 3:58 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Pulling information out of a MySQL database


Hi again,

Ok, I've heard some suggestions to my problem ... but I'm not entirely 
certain how to incorporate them, perhaps taking a look at the code would be 
helpful.

Again, the problem I'm having is as follows.  I have a simple form in which 
the user selects a month and year from two drop down menu's - based on 
their choice, the following PHP script searches a MySQL database and 
displays a basic listing (event name and date) for the selected 
month.  Then the user has the option to click an event name and receive a 
more detailed listing of the event - this is the portion that isn't working.

It seems that the script is forgetting the values entered by the user - I 
have come to this conclusion as when I replaced .$month. and .$year. 
with an actual month and year ie. 'November' and '2001' respectively, the 
detailed display works perfectly.

How can I get both the basic and detailed event listings working at the 
same time?

Thanks
-Tim


?

$db = mysql_connect(localhost, login, password);
mysql_select_db(edoinfo,$db);

if ($id) {

// query for extented information

$result = mysql_query(SELECT *, DATE_FORMAT(EventStartDate, '%W %M %D %Y') 
AS FormattedEventStartDate, DATE_FORMAT(EventEndDate, '%W %M %D %Y') AS 
FormattedEventEndDate, TIME_FORMAT(EventStartTime, '%r') AS 
FormattedEventStartTime, TIME_FORMAT(EventEndTime, '%r') AS 
FormattedEventEndTime FROM comcal WHERE id=$id and EventMonth='.$month.' 
and EventYear='.$year.',$db);

$myrow = mysql_fetch_array($result);

//display extended information

 echo table width='65%' border='0' cellspacing='2'
cellpadding='2';
   echo tr;
 echo td valign='top' align='left'bEvent: /b/td;
 echo td valign='top' align='left';
echo ($myrow[EventName]);
echo /td;
   echo /tr;
   echo tr;
 echo td valign='top' align='left'bLocation: /b/td;
echo td valign='top'
align='left'.($myrow[EventLocation])./td;
   echo /tr;
   echo tr;
echo td valign='top' align='left'bCity: /b/td;
echo td valign='top'
align='left'.($myrow[EventCity])., 
.($myrow[EventState])./td;
   echo /tr;
   echo tr;
 echo td valign='top' align='left'bTime: /b/td;
echo td valign='top' 
align='left'.($myrow[FormattedEventStartTime])./td;
   echo /tr;
   echo tr;
 echo td valign='top' align='left'bDate: /b/td;
echo td valign='top' 
align='left'.($myrow[FormattedEventStartDate])./td;
   echo /tr;
   echo tr;
echo td valign='top' align='left'bContact Person(s):
/b/td;
 echo td valign='top' align='left'.($myrow[EventC1FN]). 
.($myrow[EventC1LN]).br.($myrow[EventC2FN]). 
.($myrow[EventC2LN])./td;
   echo /tr;
   echo tr;
 echo td valign='top' align='left'bPhone: /b/td;
 echo td valign='top' 
align='left'.($myrow[EventC1ACPhone])...($myrow[EventC1ExcPhone])..
.($myrow[EventC1ExtPhone]). 
;
echo 
br.($myrow[EventC2ACPhone])...($myrow[EventC2ExcPhone])...($myro
w[EventC2ExtPhone]). 
;
echo /td;
   echo /tr;
   echo tr;
echo td valign='top' align='left'bFax: /b/td;
 echo td valign='top' 
align='left'.($myrow[EventACFax])...($myrow[EventExcFax])...($myro
w[EventExtFax])./td;
   echo /tr;
   echo tr;
echo td valign='top' align='left'bCell: /b/td;
 echo td valign='top' 
align='left'.($myrow[EventACCell])...($myrow[EventExcCell])...($my
row[EventExtCell])./td;
   echo /tr;
   echo tr;
echo td valign='top' align='left'bEmail:
/b/td;
 echo td valign='top' align='left'a 
href='mailto:;.($myrow[EventEmail]).'.($myrow[EventEmail