[PHP-DB] Weird PHP behavior...

2003-02-06 Thread NIPP, SCOTT V (SBCSI)
I developed some dynamic content for a larger web page, and once I
pasted the code into the appropriate area of the page I am seeing the
strangest error.  Here is the error:

Warning: Failed opening '/www/DW/index1.htm' for inclusion
(include_path='.:/usr/local/lib/php') in Unknown on line 0

I have tried this on 2 different servers running 2 different
versions of PHP, 4.1.2 and 4.2.3.  The code was developed and tested in a
blank page and then inserted into a much larger page developed in FrontPage
2002.  Any ideas?  Thanks in advance.

Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.com



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




RE: [PHP-DB] Weird PHP behavior...

2003-02-06 Thread NIPP, SCOTT V (SBCSI)
Here is the working code...
 
?php 
 require_once(/www/DW/prod.lib.php);
 $hr = date(G);
 if ($hr  7) {
  $sql = mysql(Calendar2,SELECT B.Title, UNIX_TIMESTAMP(A.StartDate),
UNIX_TIMESTAMP(A.StopDate) FROM  `phpCalendar_Details`  AS B,
`phpCalendar_Daily`  AS A WHERE A.CalendarDetailsID = B.CalendarDetailsID
AND CURDATE()  BETWEEN A.StartDate AND A.StopDate) or die(mysql_error());
  $mid = mktime (0,0,0,date(m)  ,date(d)+1,date(Y));
 } else {
  $sql = mysql(Calendar2,SELECT B.Title, UNIX_TIMESTAMP(A.StartDate),
UNIX_TIMESTAMP(A.StopDate) FROM  `phpCalendar_Details`  AS B,
`phpCalendar_Daily`  AS A WHERE A.CalendarDetailsID = B.CalendarDetailsID
AND CURDATE()-2  BETWEEN A.StartDate AND A.StopDate) or die(mysql_error());
  $sql2 = mysql(Calendar2,SELECT B.Title FROM  `phpCalendar_Details`  AS
B,  `phpCalendar_Daily`  AS A WHERE A.CalendarDetailsID =
B.CalendarDetailsID AND CURDATE()  BETWEEN A.StartDate AND A.StopDate) or
die(mysql_error());
  $res2 = mysql_fetch_row($sql2);
  $new = $res2[0];
  $mid = mktime (0,0,0,date(m)  ,date(d)-2,date(Y));
 }
 $res = mysql_fetch_row($sql);
 $sa = $res[0];
 $start = $res[1];
 $stop = $res[2];
 $day1 = date(l, $start);
 $date1 = date(jS, $start);
 $month1 = date(F, $start);
 $day3 = date(l, $stop);
 $date3 = date(jS, $stop);
 $month3 = date(F, $stop);
 if ($day1 == Friday) {
  $day2 = date(l, $mid);
  $date2 = date(jS, $mid);
  $month2 = date(F, $mid);
  if ($month1 != $month2) {
   $line2 = $month1 $date1, $month2 $date2 and $date3;
  } elseif ($month2 != $month3) {
   $line2 = $month1 $date1 and $date2, and $month3 $date3;
  } else {
   $line2 = $month1 $date1, $date2, and $date3;
  }
  $line1 = ONCALL SA for Friday, Saturday, and Sunday;
 } else {
  if ($month1 != $month3) {
   $line2 = $month1 $date1 and $date3;
  } else {
   $line2 = $month1 $date1 and $month3 $date3;
  }
  $line1 = ONCALL SA for $day1 and $day3;
 }
 
 mysql_select_db($database, $Prod);
 $query = SELECT name, pager FROM contacts_sa WHERE sbcuid='$sa';
 $said = mysql_query($query, $Prod) or die(mysql_error());
 $row = mysql_fetch_row($said);
 $name = $row[0];
 $pager = $row[1];
 
 if ($date3 == date(jS, $stop)  $hr  8) {
  $query2 = SELECT name FROM contacts_sa WHERE sbcuid='$new';
  $said2 = mysql_query($query2, $Prod) or die(mysql_error());
  $row2 = mysql_fetch_row($said2);
  $name2 = $row2[0];
  $line4 = Please be aware the On-Call turnover occurs at 8AM.  brThe
oncoming SA after 8AM will be $name2.;
 } else {
  $line4 = $name begins On-Call at 8AM on $day1.;
 }
?
html
head
titleUntitled Document/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
/head
 
body
  h2 align=centerspan lang=en-usCALL 214-741-6961 br
  FOR CURRENT ONCALL STATUS./span/h2
  hr color=#6363C9 size=3 width=50%
  p align=center?php echo $line1; ?br
  /span(span lang=en-us?php echo $line2; ?/span) br
  span lang=en-us?php echo $name; ? /span(pager span
lang=en-us
  ?php echo $pager; ?)br
  ?php echo $line4; ?/span/p
  hr color=#6363C9 size=3 width=50%
/body
/html

The portion of PHP code prior to the HTML is inserted at the top of the
file in the broken page.  Here is how the HTML portion of the PHP is
inserted...
 
snip...
  td background=images/bg_leftside.gif width=20nbsp;/td
  td width=20 background=images/bg_main.gifnbsp;/td
  td width=550 background=images/bg_main.gif valign=top
  p align=left dynamicanimation=fpAnimOutflyBottomRightFP1
id=fpAnimOu
tflyBottomRightFP1 style=position: relative !important
onclick=dynAnimOut(th
is) language=Javascript1.2nbsp;/p
 h2 align=centerspan lang=en-usCALL 214-741-6961 br
 FOR CURRENT ONCALL STATUS./span/h2
 hr color=#6363C9 size=3 width=50%
 p align=center?php echo $line1; ?br
 /span(span lang=en-us?php echo $line2; ?/span) br
 span lang=en-us?php echo $name; ? /span(pager span
lang=en-us

 ?php echo $pager; ?)br
 ?php echo $line4; ?/span/p
 hr color=#6363C9 size=3 width=50%
  h4 align=centerspan lang=en-usFor escalation procedures,
  a href=on-call/escalation.htmclick here./a/span/h4
  h4 align=centerspan lang=en-usFor restore requests call the
Help 
 
  Desk/span/h4
 
...snip

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 06, 2003 11:09 AM
To: NIPP, SCOTT V (SBCSI)
Subject: RE: [PHP-DB] Weird PHP behavior...



well show the working code and then show just a portion of the code that is
broken specifically where you are trying to inslucde the working code. 

K. 



NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED] 


02/06/2003 12:09 PM 



To:'[EMAIL PROTECTED]'
[EMAIL PROTECTED] 
cc: 
Subject:RE: [PHP-DB] Weird PHP behavior...



I can show the code, but do I show the working code?  If I show the
broken code, it is REALLY long. 
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL

Re: [PHP-DB] Weird PHP behavior...

2003-02-06 Thread Mohammad Saad
Check path on this require
require_once(/www/DW/prod.lib.php);
something is wrong with this
- Original Message -
From: NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, February 06, 2003 10:17 PM
Subject: RE: [PHP-DB] Weird PHP behavior...


 Here is the working code...

 ?php
  require_once(/www/DW/prod.lib.php);
  $hr = date(G);
  if ($hr  7) {
   $sql = mysql(Calendar2,SELECT B.Title, UNIX_TIMESTAMP(A.StartDate),
 UNIX_TIMESTAMP(A.StopDate) FROM  `phpCalendar_Details`  AS B,
 `phpCalendar_Daily`  AS A WHERE A.CalendarDetailsID = B.CalendarDetailsID
 AND CURDATE()  BETWEEN A.StartDate AND A.StopDate) or die(mysql_error());
   $mid = mktime (0,0,0,date(m)  ,date(d)+1,date(Y));
  } else {
   $sql = mysql(Calendar2,SELECT B.Title, UNIX_TIMESTAMP(A.StartDate),
 UNIX_TIMESTAMP(A.StopDate) FROM  `phpCalendar_Details`  AS B,
 `phpCalendar_Daily`  AS A WHERE A.CalendarDetailsID = B.CalendarDetailsID
 AND CURDATE()-2  BETWEEN A.StartDate AND A.StopDate) or
die(mysql_error());
   $sql2 = mysql(Calendar2,SELECT B.Title FROM  `phpCalendar_Details`
AS
 B,  `phpCalendar_Daily`  AS A WHERE A.CalendarDetailsID =
 B.CalendarDetailsID AND CURDATE()  BETWEEN A.StartDate AND A.StopDate) or
 die(mysql_error());
   $res2 = mysql_fetch_row($sql2);
   $new = $res2[0];
   $mid = mktime (0,0,0,date(m)  ,date(d)-2,date(Y));
  }
  $res = mysql_fetch_row($sql);
  $sa = $res[0];
  $start = $res[1];
  $stop = $res[2];
  $day1 = date(l, $start);
  $date1 = date(jS, $start);
  $month1 = date(F, $start);
  $day3 = date(l, $stop);
  $date3 = date(jS, $stop);
  $month3 = date(F, $stop);
  if ($day1 == Friday) {
   $day2 = date(l, $mid);
   $date2 = date(jS, $mid);
   $month2 = date(F, $mid);
   if ($month1 != $month2) {
$line2 = $month1 $date1, $month2 $date2 and $date3;
   } elseif ($month2 != $month3) {
$line2 = $month1 $date1 and $date2, and $month3 $date3;
   } else {
$line2 = $month1 $date1, $date2, and $date3;
   }
   $line1 = ONCALL SA for Friday, Saturday, and Sunday;
  } else {
   if ($month1 != $month3) {
$line2 = $month1 $date1 and $date3;
   } else {
$line2 = $month1 $date1 and $month3 $date3;
   }
   $line1 = ONCALL SA for $day1 and $day3;
  }

  mysql_select_db($database, $Prod);
  $query = SELECT name, pager FROM contacts_sa WHERE sbcuid='$sa';
  $said = mysql_query($query, $Prod) or die(mysql_error());
  $row = mysql_fetch_row($said);
  $name = $row[0];
  $pager = $row[1];

  if ($date3 == date(jS, $stop)  $hr  8) {
   $query2 = SELECT name FROM contacts_sa WHERE sbcuid='$new';
   $said2 = mysql_query($query2, $Prod) or die(mysql_error());
   $row2 = mysql_fetch_row($said2);
   $name2 = $row2[0];
   $line4 = Please be aware the On-Call turnover occurs at 8AM.  brThe
 oncoming SA after 8AM will be $name2.;
  } else {
   $line4 = $name begins On-Call at 8AM on $day1.;
  }
 ?
 html
 head
 titleUntitled Document/title
 meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
 /head

 body
   h2 align=centerspan lang=en-usCALL 214-741-6961 br
   FOR CURRENT ONCALL STATUS./span/h2
   hr color=#6363C9 size=3 width=50%
   p align=center?php echo $line1; ?br
   /span(span lang=en-us?php echo $line2; ?/span) br
   span lang=en-us?php echo $name; ? /span(pager span
 lang=en-us
   ?php echo $pager; ?)br
   ?php echo $line4; ?/span/p
   hr color=#6363C9 size=3 width=50%
 /body
 /html

 The portion of PHP code prior to the HTML is inserted at the top of
the
 file in the broken page.  Here is how the HTML portion of the PHP is
 inserted...

 snip...
   td background=images/bg_leftside.gif width=20nbsp;/td
   td width=20 background=images/bg_main.gifnbsp;/td
   td width=550 background=images/bg_main.gif valign=top
   p align=left dynamicanimation=fpAnimOutflyBottomRightFP1
 id=fpAnimOu
 tflyBottomRightFP1 style=position: relative !important
 onclick=dynAnimOut(th
 is) language=Javascript1.2nbsp;/p
  h2 align=centerspan lang=en-usCALL 214-741-6961 br
  FOR CURRENT ONCALL STATUS./span/h2
  hr color=#6363C9 size=3 width=50%
  p align=center?php echo $line1; ?br
  /span(span lang=en-us?php echo $line2; ?/span) br
  span lang=en-us?php echo $name; ? /span(pager span
 lang=en-us
 
  ?php echo $pager; ?)br
  ?php echo $line4; ?/span/p
  hr color=#6363C9 size=3 width=50%
   h4 align=centerspan lang=en-usFor escalation procedures,
   a href=on-call/escalation.htmclick here./a/span/h4
   h4 align=centerspan lang=en-usFor restore requests call the
 Help

   Desk/span/h4

 ...snip

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, February 06, 2003 11:09 AM
 To: NIPP, SCOTT V (SBCSI)
 Subject: RE: [PHP-DB] Weird PHP behavior...



 well show the working code and then show just a portion of the code that
is
 broken specifically where you are trying to inslucde the working

RE: [PHP-DB] Weird PHP behavior...

2003-02-06 Thread NIPP, SCOTT V (SBCSI)
It turned out to be just a simple file permissions issue.

-Original Message-
From: Mohammad Saad [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 06, 2003 12:31 PM
To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: Re: [PHP-DB] Weird PHP behavior...


Check path on this require
require_once(/www/DW/prod.lib.php);
something is wrong with this
- Original Message -
From: NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, February 06, 2003 10:17 PM
Subject: RE: [PHP-DB] Weird PHP behavior...


 Here is the working code...

 ?php
  require_once(/www/DW/prod.lib.php);
  $hr = date(G);
  if ($hr  7) {
   $sql = mysql(Calendar2,SELECT B.Title, UNIX_TIMESTAMP(A.StartDate),
 UNIX_TIMESTAMP(A.StopDate) FROM  `phpCalendar_Details`  AS B,
 `phpCalendar_Daily`  AS A WHERE A.CalendarDetailsID = B.CalendarDetailsID
 AND CURDATE()  BETWEEN A.StartDate AND A.StopDate) or die(mysql_error());
   $mid = mktime (0,0,0,date(m)  ,date(d)+1,date(Y));
  } else {
   $sql = mysql(Calendar2,SELECT B.Title, UNIX_TIMESTAMP(A.StartDate),
 UNIX_TIMESTAMP(A.StopDate) FROM  `phpCalendar_Details`  AS B,
 `phpCalendar_Daily`  AS A WHERE A.CalendarDetailsID = B.CalendarDetailsID
 AND CURDATE()-2  BETWEEN A.StartDate AND A.StopDate) or
die(mysql_error());
   $sql2 = mysql(Calendar2,SELECT B.Title FROM  `phpCalendar_Details`
AS
 B,  `phpCalendar_Daily`  AS A WHERE A.CalendarDetailsID =
 B.CalendarDetailsID AND CURDATE()  BETWEEN A.StartDate AND A.StopDate) or
 die(mysql_error());
   $res2 = mysql_fetch_row($sql2);
   $new = $res2[0];
   $mid = mktime (0,0,0,date(m)  ,date(d)-2,date(Y));
  }
  $res = mysql_fetch_row($sql);
  $sa = $res[0];
  $start = $res[1];
  $stop = $res[2];
  $day1 = date(l, $start);
  $date1 = date(jS, $start);
  $month1 = date(F, $start);
  $day3 = date(l, $stop);
  $date3 = date(jS, $stop);
  $month3 = date(F, $stop);
  if ($day1 == Friday) {
   $day2 = date(l, $mid);
   $date2 = date(jS, $mid);
   $month2 = date(F, $mid);
   if ($month1 != $month2) {
$line2 = $month1 $date1, $month2 $date2 and $date3;
   } elseif ($month2 != $month3) {
$line2 = $month1 $date1 and $date2, and $month3 $date3;
   } else {
$line2 = $month1 $date1, $date2, and $date3;
   }
   $line1 = ONCALL SA for Friday, Saturday, and Sunday;
  } else {
   if ($month1 != $month3) {
$line2 = $month1 $date1 and $date3;
   } else {
$line2 = $month1 $date1 and $month3 $date3;
   }
   $line1 = ONCALL SA for $day1 and $day3;
  }

  mysql_select_db($database, $Prod);
  $query = SELECT name, pager FROM contacts_sa WHERE sbcuid='$sa';
  $said = mysql_query($query, $Prod) or die(mysql_error());
  $row = mysql_fetch_row($said);
  $name = $row[0];
  $pager = $row[1];

  if ($date3 == date(jS, $stop)  $hr  8) {
   $query2 = SELECT name FROM contacts_sa WHERE sbcuid='$new';
   $said2 = mysql_query($query2, $Prod) or die(mysql_error());
   $row2 = mysql_fetch_row($said2);
   $name2 = $row2[0];
   $line4 = Please be aware the On-Call turnover occurs at 8AM.  brThe
 oncoming SA after 8AM will be $name2.;
  } else {
   $line4 = $name begins On-Call at 8AM on $day1.;
  }
 ?
 html
 head
 titleUntitled Document/title
 meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
 /head

 body
   h2 align=centerspan lang=en-usCALL 214-741-6961 br
   FOR CURRENT ONCALL STATUS./span/h2
   hr color=#6363C9 size=3 width=50%
   p align=center?php echo $line1; ?br
   /span(span lang=en-us?php echo $line2; ?/span) br
   span lang=en-us?php echo $name; ? /span(pager span
 lang=en-us
   ?php echo $pager; ?)br
   ?php echo $line4; ?/span/p
   hr color=#6363C9 size=3 width=50%
 /body
 /html

 The portion of PHP code prior to the HTML is inserted at the top of
the
 file in the broken page.  Here is how the HTML portion of the PHP is
 inserted...

 snip...
   td background=images/bg_leftside.gif width=20nbsp;/td
   td width=20 background=images/bg_main.gifnbsp;/td
   td width=550 background=images/bg_main.gif valign=top
   p align=left dynamicanimation=fpAnimOutflyBottomRightFP1
 id=fpAnimOu
 tflyBottomRightFP1 style=position: relative !important
 onclick=dynAnimOut(th
 is) language=Javascript1.2nbsp;/p
  h2 align=centerspan lang=en-usCALL 214-741-6961 br
  FOR CURRENT ONCALL STATUS./span/h2
  hr color=#6363C9 size=3 width=50%
  p align=center?php echo $line1; ?br
  /span(span lang=en-us?php echo $line2; ?/span) br
  span lang=en-us?php echo $name; ? /span(pager span
 lang=en-us
 
  ?php echo $pager; ?)br
  ?php echo $line4; ?/span/p
  hr color=#6363C9 size=3 width=50%
   h4 align=centerspan lang=en-usFor escalation procedures,
   a href=on-call/escalation.htmclick here./a/span/h4
   h4 align=centerspan lang=en-usFor restore requests call the
 Help

   Desk/span/h4

 ...snip

 -Original Message-
 From: [EMAIL PROTECTED