Re: [PHP-DB] PHP - Oracle 7.3.4 - ORA-12154

2003-02-06 Thread Maxim Maletsky

add the failover directive in tnsnames.ora. Find how to on the web (not
sure right now)

-- 
Maxim Maletsky
[EMAIL PROTECTED]


On Fri, 07 Feb 2003 02:15:43 + Maron Kristófersson <[EMAIL PROTECTED]> wrote:

> Hello!
> 
> I set up PHP on a Sun Solaris box a week ago (see phpinfo output below).
>It has oracle 7.3.4 and php 4.0.4pl1 so I'm using the --with-oracle
> configure option.  Due to a special module we're using we're stuck with
> using that php version (4.0.4pl1).
> 
> At first I was getting the ORA-12154 TNS:could not resolve service name
> error almost every time.  I then followed the instructions to set the
> ORACLE_HOME and TNS_ADMIN environment variables in apaches http.conf.
> I've also tried using the putenv function to set the variables.
> 
> This really improved the situation but when I found it was still not
> working I wrote a small java program that calls the php page every 15
> seconds.  About 10% of the time I get the TNS (ORA-12154) error but the
> other 90% it works perfect.  This applies both to selecting and
> inserting data.
> 
> -- partial output from phpinfo() --
> System SunOS red 5.7 Generic_106541-15 sun4u sparc SUNW,Ultra-250
> Build Date Jan 29 2003
> Configure Command './configure' '--with-apxs=/opt/apache/bin/apxs'
> '--with-mysql=no' '--with-oracle=/opt/app/oracle/product/7.3.4/'
> 
> oracle
> Oracle Support enabled
> Oracle Version 7.3
> Compile-time ORACLE_HOME /opt/app/oracle/product/7.3.4/
> Libraries Used
> 
> I really need to get this working so all ideas would be appreciated.
> 
> Best regards,
> 
> Maron Kristófersson
> Reykjavík
> Iceland
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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




[PHP-DB] PHP - Oracle 7.3.4 - ORA-12154

2003-02-06 Thread Maron Kristófersson
Hello!

I set up PHP on a Sun Solaris box a week ago (see phpinfo output below).
  It has oracle 7.3.4 and php 4.0.4pl1 so I'm using the --with-oracle
configure option.  Due to a special module we're using we're stuck with
using that php version (4.0.4pl1).

At first I was getting the ORA-12154 TNS:could not resolve service name
error almost every time.  I then followed the instructions to set the
ORACLE_HOME and TNS_ADMIN environment variables in apaches http.conf.
I've also tried using the putenv function to set the variables.

This really improved the situation but when I found it was still not
working I wrote a small java program that calls the php page every 15
seconds.  About 10% of the time I get the TNS (ORA-12154) error but the
other 90% it works perfect.  This applies both to selecting and
inserting data.

-- partial output from phpinfo() --
System SunOS red 5.7 Generic_106541-15 sun4u sparc SUNW,Ultra-250
Build Date Jan 29 2003
Configure Command './configure' '--with-apxs=/opt/apache/bin/apxs'
'--with-mysql=no' '--with-oracle=/opt/app/oracle/product/7.3.4/'

oracle
Oracle Support enabled
Oracle Version 7.3
Compile-time ORACLE_HOME /opt/app/oracle/product/7.3.4/
Libraries Used

I really need to get this working so all ideas would be appreciated.

Best regards,

Maron Kristófersson
Reykjavík
Iceland


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




Re: [PHP-DB] $_FILES missing path

2003-02-06 Thread Squirrel User
I searched for PHP script for selecting a file, but couldn't find small simple 
ones.  Well, I could write a script using opendir() and link a url to each.  
Geez, but I was hoping that someone has already done that...


Quoting Squirrel User <[EMAIL PROTECTED]>:

>  ENCTYPE="multipart/form-data">
> 
> print_r($_FILES) doesn't show full path of the filename I selected.  I'm not
> 
> trying to upload but just need to be able to open the file for viewing.
> 
> Help.
> 


-
This mail sent through ISOT.  To find out more 
about ISOT, visit http://isot.com

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




RE: [PHP-DB] how do I use same page for submit and results?

2003-02-06 Thread Luke Woollard
or you can use check for the name of the submit button using a specific
SUPERGLOBAL array.

e.g.

if ( ! empty($_POST["submit"]) ) {
   /* form was submitted */
} else {
   /* form hasn't been submitted, show it */
   echo ''
.' form fields/button goes here '
.''
.'';
}


Best to check if a variable exists

Using the other method will throw an error: Notice: Undefined index: action
in c:\program files\apache group\apache\htdocs\testerr.php on line x...



Thanks,

Luke Woollard








-Original Message-
From: Joshua Stein [mailto:[EMAIL PROTECTED]]
Sent: Friday, 7 February 2003 5:29 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] how do I use same page for submit and results?


> But now I'm not using anything that I can check except for the
> button click. Any ideas how to do this?

assign a name to the button and check for that.



...

if ($_REQUEST["action"] == "Show List") {
   /* form was submitted */
   ...
} else {
   /* form hasn't been submitted, show it */
   ...
}


   -j.

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




-- 
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)
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...
>
>   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.  The
> oncoming SA after 8AM will be $name2.";
>  } else {
>   $line4 = "$name begins On-Call at 8AM on $day1.";
>  }
> ?>
> 
> 
> Untitled Document
> 
> 
>
> 
>   CALL 214-741-6961 
>   FOR CURRENT ONCALL STATUS.
>   
>   
>   () 
>(pager  lang="en-us">
>   )
>   
>   
> 
> 
>
> 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...
>
> 
>    
>    
>   
>id="fpAnimOu
> tflyBottomRightFP1" style="position: relative !important"
> onclick="dynAnimOut(th
> is)" language="Javascript1.2"> 
>  CALL 214-741-6961 
>  FOR CURRENT ONCALL STATUS.
>  
>  
>  () 
>   (pager  lang="en-us
> ">
>  )
>  
>  
>   For escalation procedures,
>   click here.
>   For restore requests call the
> Help
>
>   Desk
>
> <...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 PROTECTED]]
> Sent: Thursday, February 06, 20

[PHP-DB] Time entry program

2003-02-06 Thread Marie Osypian
Hi,

I was looking for a basic time entry program for people to sign-in and
sign-out.  Like a time clock for example. Does anyone know of one out there
already?

Thanks,

Marie



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




[PHP-DB] Re: Oracle + PHP + Linux Red Hat {again}

2003-02-06 Thread Michael Mauch
Alberto grájeda c. <[EMAIL PROTECTED]> wrote:

> Connected to DataBase Oracle!
> Warning: OCIStmtExecute: ORA-03106: fatal two-task communication protocol 
> error in /var/www/html/ora2.php on line 21
> 
> Warning: OCIFetchStatement: ORA-24374: define not done before fetch or 
> execute and fetch in /var/www/html/ora2.php on line 22
> Found: 0 results
> 
> I'm running redhat 7.3 with oracle 9i client connecting to oracle 8.0.5 
> Server on NT. I put the putEnv to $ORACLE_HOME,$ORACLE_SID,I use 
> OCIDefineByName, but the result is the error.

Don't use PutEnv() to set these variables, and don't use Apache's
SetEnv. At least if you are using mod_php, neither PutEnv() nor SetEnv
work. Set these variables in the environment before you start Apache,
e.g. in the apachectl script.

Regards...
Michael

-- 
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 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...
>
>   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.  The
> oncoming SA after 8AM will be $name2.";
>  } else {
>   $line4 = "$name begins On-Call at 8AM on $day1.";
>  }
> ?>
> 
> 
> Untitled Document
> 
> 
>
> 
>   CALL 214-741-6961 
>   FOR CURRENT ONCALL STATUS.
>   
>   
>   () 
>(pager  lang="en-us">
>   )
>   
>   
> 
> 
>
> 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...
>
> 
>    
>    
>   
>id="fpAnimOu
> tflyBottomRightFP1" style="position: relative !important"
> onclick="dynAnimOut(th
> is)" language="Javascript1.2"> 
>  CALL 214-741-6961 
>  FOR CURRENT ONCALL STATUS.
>  
>  
>  () 
>   (pager  lang="en-us
> ">
>  )
>  
>  
>   For escalation procedures,
>   click here.
>   For restore requests call the
> Help
>
>   Desk
>
> <...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 PROTECTED]]
> Sent: Thursday, February 06, 2003 11:06 AM
> To: NIPP, SCOTT V (SBCSI)
> Subject: Re: [PHP-DB] Weird PHP behavior...
>
>
> It might help if you showed the code or at least part of it to help track
> down your problem.
>
> khris
>
>
> "NIPP, SCOTT V (SBCSI)" <[EMAIL PROTECTED]>
>
>
> 02/06/2003 12:05 PM
>
>
>To: 

Re: [PHP-DB] how do I use same page for submit and results?

2003-02-06 Thread Joshua Stein
> But now I'm not using anything that I can check except for the
> button click. Any ideas how to do this?

assign a name to the button and check for that.



...

if ($_REQUEST["action"] == "Show List") {
   /* form was submitted */
   ...
} else {
   /* form hasn't been submitted, show it */
   ...
}


   -j.

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




Re: [PHP-DB] Remnant data from previous queries when using mysql_fetch_array...

2003-02-06 Thread Doug Thompson
On Thu, 06 Feb 2003 10:33:23 -0700, Doug Thompson wrote:

>Try getting the results from the query like the following.

-snip-
With the correct syntax.  8-(
Doh!

>
>//
>$numrows = mysql_num_rows ($result);
>   ^



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




Re: [PHP-DB] Remnant data from previous queries when using mysql_fetch_array...

2003-02-06 Thread Doug Thompson
Try getting the results from the query like the following.

Doug


// generate and execute query
$query = "select * from changelog where changedBy = '$changedBy' or
vendorNumber = '$vendorNumber'
or oldName like '$oldName' or newName like '$newName' or
newVendorNumber =
'$newVendorNumber'";
$result = mysql_query($query) or die ("Error in query: $query. " .
mysql_error());

//
$numrows = mysql_num_rows ($result)

if ($numrows) {
while ($row = mysql_fetch_array($result)) {
   print "Old vendor number: ";
   print $row["vendorNumber"];
   print "";
  }  //end while

//


} else {print "Sorry, no records were found!";}

// close database connection
mysql_close($connection);

On Thu, 6 Feb 2003 11:41:30 -0500, Mike Hilty wrote:

>Okay, I figured out that the issue is not due to the PHP code, but by the
>query I'm using against the MySQL DB...
>
>What I need to know is how to structure the code where the query is based
>off of fields filled in by the user.  I would like to structure the query
>where if the user provides a value for vendorNumber, and leaves the rest of
>the fields blank, the query would be "select * from changeLog where
>vendorNumber = '$vendorNumber';"
>
>The current query, when run in MySQL Control Center, gives the same behavior
>as on the website.
>
>Would I have to write this portion of the code in javascript, or some other
>client side scripting language to get the dynamic query built?
>
>Thanks,
>Mike Hilty



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




[PHP-DB] how do I use same page for submit and results?

2003-02-06 Thread John A DAVIS
On my choices page, there are only 3 radio buttons and a Submit button.

The page calls itself and runs a query on the database, displaying results. But the 
criteria buttons are still at the top of the page above the results. Before, I had a 
combo box for certain choices and I just did an "If (!$ComboBoxName) { yada yada} 
die;".

But now I'm not using anything that I can check except for the button click. Any ideas 
how to do this?

echo "\n";

echo "";
echo "\n"; 

//search page title
echo "  Inventory List";


echo "";

echo "";
echo "";
echo "Activity Status";
echo "  Active 
";
echo "  Inactive ";
echo "  Both 
";

echo "(takes a while to build complete inventory)";
echo "";
echo "";
echo "";


echo "";
echo "";

die;

—-query and display code down here


--
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...
 
 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.  The
oncoming SA after 8AM will be $name2.";
 } else {
  $line4 = "$name begins On-Call at 8AM on $day1.";
 }
?>


Untitled Document


 

  CALL 214-741-6961 
  FOR CURRENT ONCALL STATUS.
  
  
  () 
   (pager 
  )
  
  



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...
 

   
   
  
   
 CALL 214-741-6961 
 FOR CURRENT ONCALL STATUS.
 
 
 () 
  (pager 
 )
 
 
  For escalation procedures,
  click here.
  For restore requests call the
Help 
 
  Desk
 
<...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 PROTECTED]]
Sent: Thursday, February 06, 2003 11:06 AM
To: NIPP, SCOTT V (SBCSI)
Subject: Re: [PHP-DB] Weird PHP behavior...


It might help if you showed the code or at least part of it to help track
down your problem. 

khris 


"NIPP, SCOTT V (SBCSI)" <[EMAIL PROTECTED]> 


02/06/2003 12:05 PM 


   To:"'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> 
   cc: 
   Subject:[PHP-DB] Weird PHP behavior...




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.sb

[PHP-DB] Re: Something is fishy in my selection

2003-02-06 Thread Mathieu Dumoulin
Oh crap, someone mailed me about having nulls in my field compared...
you can no disregard this thread...its closed i got the culprit, it's a
stupid NULL i found in a column

Mathieu Dumoulin

"Mathieu Dumoulin" <[EMAIL PROTECTED]> a écrit dans le message de
news: [EMAIL PROTECTED]
> More info on this problem, i tried running the queries (the NOT IN and the
> IN) while TRIM() the field compared just to see  and i did that in a web
> page directly thru the mysql<=>php api.
>
> Results:
>
> Trimming and using in list: 6286
> Trimming and using not in list: 7
> Not trimming and using in list: 6286
> Not trimming and using not in list: 7
>
> So no change...
> This seems to be a bug in mysql...
>
> Mathieu Dumoulin
>
> "Mathieu Dumoulin" <[EMAIL PROTECTED]> a écrit dans le message de
> news: [EMAIL PROTECTED]
> > Hi there, want to say this right off the start the calculations here are
> > used with the totals of the results and not the range so dont go telling
> me
> > that i might have used a 0 based index, NO...
> >
> > I have 6294 lines in my table
> > i query with a IN (...) statement and i get 6286 lines out of my DB
> > i query again using the same list but with NOT IN (...) and i get 7
lines
> >
> > Theoricaly, i should get all lines thru this way of doing right? Well
> count:
> >
> > 6286+7 = 6293
> >
> > Where is my last line??? Could this be a bug in the IN, NOT IN
statements
> of
> > mysql? or is this part of a problem related to phpMyAdmin? I will try to
> run
> > these queries right off a web page using the direct api to the mysql
> > database to see if it's in phpMyAdmin or mysql, till then i hope someone
> can
> > find something wrong in my doing, it's only logical that i should get
all
> > lines!!!
> >
> > Mathieu
> >
> >
>
>



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




[PHP-DB] Re: Something is fishy in my selection

2003-02-06 Thread Mathieu Dumoulin
More info on this problem, i tried running the queries (the NOT IN and the
IN) while TRIM() the field compared just to see  and i did that in a web
page directly thru the mysql<=>php api.

Results:

Trimming and using in list: 6286
Trimming and using not in list: 7
Not trimming and using in list: 6286
Not trimming and using not in list: 7

So no change...
This seems to be a bug in mysql...

Mathieu Dumoulin

"Mathieu Dumoulin" <[EMAIL PROTECTED]> a écrit dans le message de
news: [EMAIL PROTECTED]
> Hi there, want to say this right off the start the calculations here are
> used with the totals of the results and not the range so dont go telling
me
> that i might have used a 0 based index, NO...
>
> I have 6294 lines in my table
> i query with a IN (...) statement and i get 6286 lines out of my DB
> i query again using the same list but with NOT IN (...) and i get 7 lines
>
> Theoricaly, i should get all lines thru this way of doing right? Well
count:
>
> 6286+7 = 6293
>
> Where is my last line??? Could this be a bug in the IN, NOT IN statements
of
> mysql? or is this part of a problem related to phpMyAdmin? I will try to
run
> these queries right off a web page using the direct api to the mysql
> database to see if it's in phpMyAdmin or mysql, till then i hope someone
can
> find something wrong in my doing, it's only logical that i should get all
> lines!!!
>
> Mathieu
>
>



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




[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




[PHP-DB] Something is fishy in my selection

2003-02-06 Thread Mathieu Dumoulin
Hi there, want to say this right off the start the calculations here are
used with the totals of the results and not the range so dont go telling me
that i might have used a 0 based index, NO...

I have 6294 lines in my table
i query with a IN (...) statement and i get 6286 lines out of my DB
i query again using the same list but with NOT IN (...) and i get 7 lines

Theoricaly, i should get all lines thru this way of doing right? Well count:

6286+7 = 6293

Where is my last line??? Could this be a bug in the IN, NOT IN statements of
mysql? or is this part of a problem related to phpMyAdmin? I will try to run
these queries right off a web page using the direct api to the mysql
database to see if it's in phpMyAdmin or mysql, till then i hope someone can
find something wrong in my doing, it's only logical that i should get all
lines!!!

Mathieu



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




Re: [PHP-DB] Remnant data from previous queries when using mysql_fetch_array...

2003-02-06 Thread Mike Hilty
Okay, I figured out that the issue is not due to the PHP code, but by the
query I'm using against the MySQL DB...

What I need to know is how to structure the code where the query is based
off of fields filled in by the user.  I would like to structure the query
where if the user provides a value for vendorNumber, and leaves the rest of
the fields blank, the query would be "select * from changeLog where
vendorNumber = '$vendorNumber';"

The current query, when run in MySQL Control Center, gives the same behavior
as on the website.

Would I have to write this portion of the code in javascript, or some other
client side scripting language to get the dynamic query built?

Thanks,
Mike Hilty

"John W. Holmes" <[EMAIL PROTECTED]> wrote in message
002b01c2cd7a$2a86d9a0$7c02a8c0@coconut">news:002b01c2cd7a$2a86d9a0$7c02a8c0@coconut...
> > I am a novice PHP dev having a strange issue with
> mysql_fetch_array.
> > For some reason, it is keeping data from previous queries in the
> array,
> > and
> > displaying it in the web page.
> > My development platform is Win2k SP2, Apache 1.3.23, PHP 4.3.0,
> > MySQL-MAX 3.23.47-nt.
> > Here is the code that I am using:
> >
> >  > // open database connection
> > $connection = mysql_connect(localhost, username, password) or die
> ("Unable
> > to
> > connect!");
> >
> > // select database
> > mysql_select_db(vendorNameChange) or die ("Unable to select
> database!");
> >
> > // generate and execute query
> > $query = "select * from changelog where changedBy = '$changedBy' or
> > vendorNumber = '$vendorNumber'
> > or oldName like '$oldName' or newName like '$newName' or
> newVendorNumber =
> > '$newVendorNumber'";
> > $result = mysql_query($query) or die ("Error in query: $query. " .
> > mysql_error());
> >
> > if ($row = mysql_fetch_array($result)) {
> >
> > do {
> > print "Old vendor number: ";
> > print $row["vendorNumber"];
> > print "";
> > 
> > 
> > } while($row = mysql_fetch_array($result));
> >
> > } else {print "Sorry, no records were found!";}
> >
> > // close database connection
> > mysql_close($connection);
> >
> > ?>
> >
> > I am looking for a way to initialize the array, and display only
> the
> > data returned from the current query on the page.  Any help with this
> > would
> > be greatly appreciated.
>
> $row = array();
>
> will initialize the $row variable to an empty array. Or you can use
> unset($row) to just get rid of it entirely.
>
> The problem isn't with mysql_query(), it's just that $row is retaining
> data from a previous loop in your script.
>
> ---John W. Holmes...
>
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
>
>



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




Re: [PHP-DB] PHP Database Abstraction Layer

2003-02-06 Thread Maxim Maletsky

"Luke Woollard" <[EMAIL PROTECTED]> wrote... :

> I once read a great article in the first or second issue of
> http://www.phparch.com/ on database abstraction layers. At which point I
> used the tutorial as a starting point for creating a very similar structure
> I named dbWave. There are only minor differences and a postgresql driver is
> now included for the most common pg_* functions.
> 
> I was just wondering if anyone has developed a database abstraction layer
> that allows you to separate your SQL queries from your application logic
> like dbWave does? I'm looking for a more advanced way of doing this?
> 
> 
> Attached is dbWave for anyone to look at/use. To run it you need to use the
> following tags in your file:
> 
>   // DBWave include files
>   include( "[attached_filename].php" );
> 
> To instantiate the dbWave object you use the following code in a file name
> connect.php
>  
>   /* This file instantiates dbWave using our chosen API */
>   /* It is automatically generated by the database setup program */
> 
>   // Instantiate dbWave using the MySQL API
>   $dbWave = new Mysql();
> 
>   // Connect to the database
>   $dbWave->connect( 'yourhost', 'yourport', 'yourdbname', 'yourdbuser',
> 'yourdbpass' );
> ?>


ZoomStats uses it: http://sf.net/projects/zoomstats

P.S: I wrote that phparch article, and I based it on my ZoomStats
experoence which I also founded.


--
Maxim Maletsky
[EMAIL PROTECTED]


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




[PHP-DB] Re: Argh ! array help required :(

2003-02-06 Thread Nenad Djordjevic
Hello Aaron,


* Try code like:

for ($i=0; $i
Product 1
Product 2
Product 3
Product 4
Product 5





Best regards,
 Nenad Djordjevic   mailto:[EMAIL PROTECTED]
   
   Diyomi Soft
   http://www.diyomisoft.com/


Wednesday, February 5, 2003, 6:13:27 PM, you wrote:

AW> Hi All,
 
AW> Again.. a little off topic - sorry (again!).
 
AW> Have a form that allows me to select a bunch of product names from a
AW> drop down combo box.
 
AW> I'm trying to create code like "in ('Product name1','Product Name2) to
AW> be inserted into an SQL statement.
 
AW> I figured that since $products was ALREADY in an array format the code
AW> below would work.. but it doesn't:
 
AW> $prod_search = "in(";
AW> for ($i=0;$i $prod_search .= escapeValue($products[$i]);
AW> if ($i != (count($products) - 1)) {
AW> $prod_search .= ",";
AW> }
AW> }
 
AW> $prod_search .= ")";
 
AW> Can anyone see where I am going wrong?
 
AW> Thanks!
 
 
 
AW> Aaron 


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