Re: [PHP-DB] deleting carts

2001-02-24 Thread Jorge Santos

Hi Nick,

Of course it's possible. Anything is possible. Simply generate a simple PHP
script that will be executed from the command line which is called from a
cron. The PHP script would simple delete any records where (current date) -
(your date_added) >= 90 days.

On the other hand, on the shopping cart that I wrote, I did it another way;
instead of creating a separate script and additional external components
(the cron for example), simple create 1 function that holds the
functionality needed to delete the old records. Then just call the function
each time your cart script is called. There's no reason to create a cron to
delete records because you can have the shopping cart script do it
automatically...


Hope this helps,
Jorge
[EMAIL PROTECTED]
- Original Message -
From: Nicholas W. Miller <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, February 24, 2001 11:31 PM
Subject: [PHP-DB] deleting carts


> I am developing a shopping cart style e-commerce web site.   I have a
> table called carts that holds users' cart items ... so one user may
> have several entries in this table:
>
> ++--+--+-+-+---+
> | Field  | Type | Null | Key | Default | Extra |
> ++--+--+-+-+---+
> | cust_id| int(11)  |  | | 0   |   |
> | item_id| int(11)  | YES  | | NULL|   |
> | qty| tinyint(4)   | YES  | | NULL|   |
> | price  | float(10,2)  | YES  | | NULL|   |
> | date_added | timestamp(6) | YES  | | NULL|   |
> ++--+--+-+-+---+
>
> I would like to write a PHP script that I will cron which will delete
> all items belonging to a user if their most recent item is over 90
> days old.
>
> Is this possible?
>
> Nick
>
> --
> PHP Database 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 Database 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-DB] Oracle & WinNT4/2000

2001-02-19 Thread Jorge Santos

Randall,

Apparently I mis-understood you. I thought you meant upgrade the servers...
Yes we can upgrade the client. Do you have a URL available for the 8.1.6
version of the client... Thanks.


Later,
Jorge
[EMAIL PROTECTED]
- Original Message -
From: Randall Barber <[EMAIL PROTECTED]>
To: Jorge Santos <[EMAIL PROTECTED]>
Sent: Monday, February 19, 2001 1:18 AM
Subject: Re: [PHP-DB] Oracle & WinNT4/2000


> They won't let you upgrade the client?  That sounds strange.  Let them
leave
> the server at 8.0.5 and you upgrade the Windows Oracle client to 8.1.6.
> That is all I was alluding to.  I have also been told (though I haven't
> tried it) that the Oracle client for linux works well with linux so those
> problems don't seem to pester the un*x guys.  If I had my way, I'd be on a
> un*x box of some sort.
>
> Hope I understood you correctly,
> good hunting
> RDB
>
> > Unfortunately, upgrading the Oracle boxes is not an option. The current
> > Oracle version databases are part of a massive, already in production
> system
> > and is out of the question. We're adding additional components and I
> > STRONGLY recommended using PHP for server-side functionality.
> >
> > If I can't connect to a remote Oracle 8.0.5 from PHP, I'll have to use
> some
> > other tool, like ASP I would really not like to do that there's a
> > possibility that the additional components be moved to a Unix box. If I
> > initially use ASP, then moving to Unix is out of the question...
> >
> > Anyone else have this problem (PHP to Oracle 8.0.5)??
> >
> > Later,
> > Jorge
>
>


-- 
PHP Database 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-DB] Oracle & WinNT4/2000

2001-02-18 Thread Jorge Santos

Unfortunately, upgrading the Oracle boxes is not an option. The current
Oracle version databases are part of a massive, already in production system
and is out of the question. We're adding additional components and I
STRONGLY recommended using PHP for server-side functionality.

If I can't connect to a remote Oracle 8.0.5 from PHP, I'll have to use some
other tool, like ASP I would really not like to do that there's a
possibility that the additional components be moved to a Unix box. If I
initially use ASP, then moving to Unix is out of the question...

Anyone else have this problem (PHP to Oracle 8.0.5)??

Later,
Jorge
[EMAIL PROTECTED]
- Original Message -
From: Randall Barber <[EMAIL PROTECTED]>
To: Jorge Santos <[EMAIL PROTECTED]>
Sent: Friday, February 16, 2001 10:42 PM
Subject: Re: [PHP-DB] Oracle & WinNT4/2000


> Try upgrading to Oracle Client 8.1.6.  That was only way I could get it to
> work right.  For whatever reason, PHP and oracle don't get along on
Windows.
> I can use ASP no problem on those earlier versions of the oracle client.
>
> If you can't find the 8.1.6 client, let me know, I'll give you a link to
the
> one I found. (200M sheesh).
>
> Our remote server is 8.0.2.4 I think.  Not much trouble connecting to the
> older server with the new client, just couldn't get PHP to do anything.
>
> > Randall,
> >
> > I have the basic setup but still can't make it work... My versions are
> > different however. Here's what I have:
> >
> > Remote Server Oracle 8.0.5
> > Web Server: Apache on Windows 95 with Oracle Client (SQL Plus 8.0.5)
> > Also tried Web Server: IIS4 on Windows NT 4.0 Service pack 4, same
Oracle
> > Client
> > (Note: I can tnsping and connect to the database with sql plus from both
> > boxes)
> >
> > I have TNS_ADMIN and ORACLE_HOME set:
> > I also tried setting ORACLE_SID as well.
> > I am using OCI (php_oci8.dll).
> >
> > I'm still getting the
> > Warning: _oci_open_server: ORA-12154: TNS:could not resolve service name
> in
> > ...
> > error message...
> >
> > Could you provide advice and/or additional details... (I think it's a
> > problem with the Oracle client version 8.0.5 drivers and PHP but since I
> > don't have another version of Oracle to test with)
> >
> > Thanks for the help...
> > Later,
> > Jorge
> > [EMAIL PROTECTED]
> > - Original Message -
> > From: Randall Barber <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, February 14, 2001 4:35 PM
> > Subject: [PHP-DB] Oracle & WinNT4/2000
> >
> >
> > To anyone who cares:
> >
> > I recently was able to get the following setup to work correctly with
PHP
> > connecting to an oracle database from Windows:
> >
> > Remote Server:   Oracle 8 (8.0.2.4)
> >
> > Web Server: Win2000, Oracle 8i Client (8.1.6.0) w/8.1.6.3 ODBC Drivers
> > (separate download) (for odbc functions)
> >
> > I have tested it on PHP ASAPI with no problems.  I suspect the CGI
version
> > will also work.
> >
> > Used PHPOCI8.DLL extension.
> >
> > I have TNS_ADMIN, ORACLE_HOME environment variables defined.
> >
> > NOTE: The earlier client release 8.0.2.4 does not work on Win2k or
WinNT4
> > (at least I couldn't get it to).  The 8.1.6 client is the only one that
> > supports Win2k (future versions will, just nothing previous will have
> Win2k
> > support added).
> >
> > Hope this helps anyone who is having trouble,
> > RDB
> >
> > P.S. - I'm happy to give greater details to anyone who wants them
> >
> >
>


-- 
PHP Database 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-DB] Passing vars

2001-02-14 Thread Jorge Santos

Another possible way is to perhaps use an external file... For instance take
the variable that is 30 lines long write it into a temporary directory/file
and then use the include function to include that file. Write the output
such that the data is assigned to a variable. Something like this:

"); /*  here we terminate the quoted string */

when done, tempfile.php should look like this:




 then call your other page like this:
test.php?cheesefile=tempfile.php

and then when the test.php starts you can use an include file like this:



Once you do that, $cheese will automatically be containing the 30 lines of
stuff you assigned to it It's very simple as you can see but it does
require a bit of maintenance (how to delete tempfile, etc...) but it is a
solution rather than passing 30 lines of text from server to client. Keep in
mind that transfering all that might cause additional problems and
performance issues. By keeping your data at hand on the server a simple
fopen and fclose can do the job. By self writing code you only have to write
the file and not read it later.

My 2 cents,
(Perhaps 3 cents),
Jorge
[EMAIL PROTECTED]
- Original Message -
From: Maureen <[EMAIL PROTECTED]>
To: Tanya Brethour <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, February 14, 2001 3:51 PM
Subject: Re: [PHP-DB] Passing vars


> I may be totally wrong or missing something, (if so, someone please let
> me know) but ...
>
> 1. One way would be to use the variables and urlencode them before
> passing them.
> $var1=urlencode($var1)
> then you have test.php?cheese=""
>
> OR
>
> 2.  Another way would be to use a form:
> 
>
> and then add the 6 variables as
>
> 
> 
> 
> 
> 
> 
>
> and then have a submit button to take you to the next page.
>
> Tanya Brethour wrote:
>
> > Quick question..
> >
> > If I have like 6 variables to pass to another PHP script... and some of
> > the vars are actually multiple lines of text (lets say over 30 lines).
> > What is the best way of doing this?
> >
> > I would like to avoid doing something like test.php?cheese=(30 lines of
> > stuff)
> >
> > Thanks in advance!
> > -Tanya
>
>
> --
> PHP Database 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 Database 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-DB] Undefined Variable and argument not valid . . .

2001-02-14 Thread Jorge Santos

Hi John,

Considering that I don't have MySql installed here and therefore can't test
your code, I'm going to guess that the msql_fetch_array is not storing the
array as per the indexes that you want. Try using MYSQL_ASSOC or MYSQL_BOTH
as the second parameter. MYSQL_ASSOC causes the elements to be indexed by
field names and MYSQL_BOTH FORCES the indexes to be stored both ways. It may
be possible that your default is setup to MYSQL_NUM and that would be why
you're getting an error.

Try:
$myrow = mysql_fetch_array($result,MYSQL_ASSOC);

Hope this helps.
Later,
Jorge
[EMAIL PROTECTED]
- Original Message -
From: John Halladay <[EMAIL PROTECTED]>
To: 'Jorge Santos' <[EMAIL PROTECTED]>
Sent: Wednesday, February 14, 2001 1:11 PM
Subject: RE: [PHP-DB] Undefined Variable and argument not valid . . .


> Great!  That fixed the first error, but I'm still getting the other error
on
> the second page stating:
>
> Warning: Supplied argument is not a valid MySQL result resource in
> C:\Inetpub\wwwroot/maybe.php on line 15
> Company Name:
> Contact:
> Phone Number:
>
> Here is line 15:
>
> $myrow = mysql_fetch_array($result);
>
> Any ideas?  Thanks again for your help.
>
> John
>
> -Original Message-
> From: Jorge Santos [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 14, 2001 11:05 AM
> To: John Halladay
> Cc: PHP-DB
> Subject: Re: [PHP-DB] Undefined Variable and argument not valid . . .
>
>
> Hi  John,
>
> You're trying to use a variable that is not set. Try using the isset
> function... Like this:
>
> if (isset($COCOD))
> $result = mysql_query("SELECT * FROM tblAA_MIKER_COMPDAT WHERE
> COCOD=$COCOD",$db);
>
> Hope this helps...
> Later,
> Jorge
> [EMAIL PROTECTED]
> - Original Message -
> From: John Halladay <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, February 14, 2001 12:51 PM
> Subject: [PHP-DB] Undefined Variable and argument not valid . . .
>
>
> > Could someone please give me some direction on what is wrong with what I
> am
> > trying to do below.  I've checked it over but still get the same errors.
> > What I'm trying to do is have a list of links that display information
> when
> > you click them.
> >
> > I'm getting the following error at the top of the first page where all
the
> > links are displayed.
> > Warning: Undefined variable: COCOD in C:\Inetpub\wwwroot/maybe.php on
line
> > 11
> >
> > I'm getting this error when I click on one of the links and there is no
> info
> > displayed under the three listing below.
> > Warning: Supplied argument is not a valid MySQL result resource in
> > C:\Inetpub\wwwroot/maybe.php on line 15
> > Company Name:
> > Contact:
> > Phone Number:
> >
> >
> > 
> >
> > 
> >
> >  >
> > $db = mysql_connect("localhost", "root", "***");
> >
> > mysql_select_db("schedules",$db);
> >
> > if ($COCOD) {
> >
> > $result = mysql_query("SELECT * FROM tblAA_MIKER_COMPDAT WHERE
> > COCOD=$COCOD",$db);
> >
> > $myrow = mysql_fetch_array($result);
> >
> > printf("Company Name: %s\n", $myrow["CONAM"]);
> >
> > printf("Contact: %s\n", $myrow["Contact"]);
> >
> > printf("Phone Number: %s\n", $myrow["PhoneNumber"]);
> >
> > } else {
> >
> > $result = mysql_query("SELECT * FROM tblAA_MIKER_COMPDAT",$db);
> >
> > if ($myrow = mysql_fetch_array($result)) {
> >
> > do {
> >
> > printf("%s\n", $PHP_SELF,
$myrow["COCOD"],
> > $myrow["CONAM"]);
> >
> > } while ($myrow = mysql_fetch_array($result));
> >
> > } else {
> >
> > echo "Sorry, no records were found!";
> >
> > }
> >
> > }
> >
> > ?>
> >
> > 
> >
> > 
> >
> > Thanks.
> >
> > John Halladay
> >
> > --
> > PHP Database 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 Database 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-DB] Undefined Variable and argument not valid . . .

2001-02-14 Thread Jorge Santos

Hi  John,

You're trying to use a variable that is not set. Try using the isset
function... Like this:

if (isset($COCOD))
$result = mysql_query("SELECT * FROM tblAA_MIKER_COMPDAT WHERE
COCOD=$COCOD",$db);

Hope this helps...
Later,
Jorge
[EMAIL PROTECTED]
- Original Message -
From: John Halladay <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 14, 2001 12:51 PM
Subject: [PHP-DB] Undefined Variable and argument not valid . . .


> Could someone please give me some direction on what is wrong with what I
am
> trying to do below.  I've checked it over but still get the same errors.
> What I'm trying to do is have a list of links that display information
when
> you click them.
>
> I'm getting the following error at the top of the first page where all the
> links are displayed.
> Warning: Undefined variable: COCOD in C:\Inetpub\wwwroot/maybe.php on line
> 11
>
> I'm getting this error when I click on one of the links and there is no
info
> displayed under the three listing below.
> Warning: Supplied argument is not a valid MySQL result resource in
> C:\Inetpub\wwwroot/maybe.php on line 15
> Company Name:
> Contact:
> Phone Number:
>
>
> 
>
> 
>
> 
> $db = mysql_connect("localhost", "root", "***");
>
> mysql_select_db("schedules",$db);
>
> if ($COCOD) {
>
> $result = mysql_query("SELECT * FROM tblAA_MIKER_COMPDAT WHERE
> COCOD=$COCOD",$db);
>
> $myrow = mysql_fetch_array($result);
>
> printf("Company Name: %s\n", $myrow["CONAM"]);
>
> printf("Contact: %s\n", $myrow["Contact"]);
>
> printf("Phone Number: %s\n", $myrow["PhoneNumber"]);
>
> } else {
>
> $result = mysql_query("SELECT * FROM tblAA_MIKER_COMPDAT",$db);
>
> if ($myrow = mysql_fetch_array($result)) {
>
> do {
>
> printf("%s\n", $PHP_SELF, $myrow["COCOD"],
> $myrow["CONAM"]);
>
> } while ($myrow = mysql_fetch_array($result));
>
> } else {
>
> echo "Sorry, no records were found!";
>
> }
>
> }
>
> ?>
>
> 
>
> 
>
> Thanks.
>
> John Halladay
>
> --
> PHP Database 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 Database 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-DB] PHP4/Apache on Win95 to remote Oracle

2001-02-14 Thread Jorge Santos

Hi Stas,

I already tried that solution to no avail...

Later,
Jorge

Hello, "Jorge Santos"!
You wrote:

>  $connect = OCIPLogon ("MDC", "MDC", $tns) or die ("It's 
>  not possible to
> connect");

Try to put "MDC6" as your 3rd parameter in OCIPLogon call.

I mean if you connect as MDC/MDC@MDC6 through SQL*Net

-- 
Piloteers do it on the road


-- 
PHP Database 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-DB] PHP4/Apache on Win95 to remote Oracle

2001-02-09 Thread Jorge Santos

Mark,

> Go to bugs.php.net and search thru the open bugs for "oracle"  You'll find
> a good dozen bugs on Windows that seem to be describing this problem.
> #6396 and #8132 come to mind.

In addition, bug #7446 for standard Oracle

Later,
Jorge
[EMAIL PROTECTED]
- Original Message -
From: Mark Farver <[EMAIL PROTECTED]>
To: Jorge Santos <[EMAIL PROTECTED]>
Cc: Mark Farver <[EMAIL PROTECTED]>
Sent: Friday, February 09, 2001 9:55 AM
Subject: Re: [PHP-DB] PHP4/Apache on Win95 to remote Oracle


> On Thu, 8 Feb 2001, Jorge Santos wrote:
>
> > This isn't good news I'll let you know what I find out. If what you
> > stated is true, then where's the BUG list...
>
> Go to bugs.php.net and search thru the open bugs for "oracle"  You'll find
> a good dozen bugs on Windows that seem to be describing this problem.
> #6396 and #8132 come to mind.
>
> Mark
>
> >
> > Thanks for the info.
> > Later,
> > Jorge
> > [EMAIL PROTECTED]
> > - Original Message -
> > From: Mark Farver <[EMAIL PROTECTED]>
> > To: Jorge Santos <[EMAIL PROTECTED]>
> > Cc: PHP-DB <[EMAIL PROTECTED]>
> > Sent: Thursday, February 08, 2001 5:39 PM
> > Subject: Re: [PHP-DB] PHP4/Apache on Win95 to remote Oracle
> >
> >
> > > > Please help. I'm going maaddd trying to figure this out. I've pretty
> > much
> > > > read all of the online docs and spend countless hours reading
through
> > the
> > > > archives..
> > > >
> > > > I'm running PHP4 and Apache on my Win95 computer.
> > > > I'm trying to connect to a remote Oracle database.
> > >
> > > I had the same problem last week.  Every suggestion I got was about
> > > environment variables.   However since a tnsping from within PHP
> > > (using passthru) works fine I know better.  From examining the sqlnet
> > > files and watching the resource allocations I came to the conclusion
that
> > > PHP is hardcoded to connect only to a database located on the same
> > > machine (using BEQLOCAL).  Oracle never even bothers to read the
> > > tnsnames.ora file when its called from PHP.  This seems to be only a
> > > problem in Windows and possibly only with the Oracle8 drivers.
> > >
> > > My postings to the dev lists went unanswered but at the time I was
unsure
> > > if it was a Windows only problem.  It might be worth reposting this
info
> > > to the PHP-WIN list.
> > >
> > > My boss was very unhappy when I told him my code had to run on a Unix
> > > box.. I basically sold him on PHP due to is cross-paltform nature.
> > >
> > > ODBC might work instead, although it never did for me. Use ADODB or
> > > another abstraction layer.. this way you can switch back and forth
easier.
> > >
> > > Let me know if you figure anything else out.
> > >
> > > Mark Farver
> > > [EMAIL PROTECTED]
> > >
> > > On Thu, 8 Feb 2001, Jorge Santos wrote:
> > >
> > > > Hi all,
> > > >
> > > >
> > > > I'm getting a "Warning: _oci_open_server: ORA-12203: TNS:unable to
> > connect to destination ..." error message. Yet I know the environment is
ok
> > because I can tnsping the database name and I can connect using SQL Plus
to
> > the database.
> > > >
> > > > Here's the php code:
> > > >
> > > >  > > >  putenv("ORACLE_SID=MDC6");
> > > >  putenv("ORACLE_HOME=D:\PROGRA~1\ORAWIN95");
> > > >  putenv("TNS_ADMIN=D:\PROGRA~1\ORAWIN95\NET80\ADMIN");
> > > >
> > > >  $tns = "(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL
=TCP)(HOST
> > = njnwkora15.db.pseg.com)(PORT = 1527)))  (CONNECT_DATA = (SID
=MDC6) ) )";
> > > >
> > > >  $connect=OCIPLogon("MDC","MDC",$tns) or die("It's not possible to
> > connect");
> > > >
> > > >  $sql = "select * from district";
> > > >
> > > >  $result =OCIParse($connect,$sql);
> > > >  OCIExecute($result) or die("It's not possible to query");
> > > >
> > > >  echo("");
> > > >  while(OCIFetch($result)) {
> > > >  $CC = OCIResult($result,1);
> > > >  $CCNome = OCIResult($result,2);
> > > >  echo('' . $CC . '' . $CCNome . '');
> > > >  }
> >

Re: [PHP-DB] PHP4/Apache on Win95 to remote Oracle

2001-02-09 Thread Jorge Santos

Hi Steve,
I can successfully connect to Oracle using SQL Plus. In addition, when I
call phpinfo() all the variables are set properly and OCI is enabled...

I also changed ORACLE_HOME=D:\PROGRA~1\ORAWIN95 to have a full path name
(program files) but the problem still exists...

Later,
Jorge
[EMAIL PROTECTED]
- Original Message -
From: Steve Farmer <[EMAIL PROTECTED]>
To: Mark Farver <[EMAIL PROTECTED]>; Jorge Santos <[EMAIL PROTECTED]>
Cc: PHP-DB <[EMAIL PROTECTED]>
Sent: Thursday, February 08, 2001 10:36 PM
Subject: Re: [PHP-DB] PHP4/Apache on Win95 to remote Oracle


> Hi Guys,
>
> Not sure what your problem is since i haven't run apache on WIN32
>
> but tnsping only tells you that the listeners is running, not that
> you can connect to the database...
>
> Use sql*plus to connect and then you can be sure your Oracle client
> is installed and configured correctly.
>
> If you have all you environment variables set it should work OK..
>
> BTW i'm not sure if  putenv("ORACLE_HOME=D:\PROGRA~1\ORAWIN95");  is
> ok, i think you should put the full path name in without any ~
>
> or try installing oracle directly on the C: drive so you get a path
> with no spaces in it
>
> Otherwise it must be something to do with the way php has been compiled
...
>
> if you do a phpinfo()  do all the environment variables look OK and
> is OCI8 support complied ?
>
> I have connected remotely from linux/apahe to a variety of oracle
> DB's on a variety of remote platforms
>
> HTH
>
> Steve Farmer
>
> At 4:39 PM -0600 8/2/01, Mark Farver wrote:
> >  > Please help. I'm going maaddd trying to figure this out. I've pretty
much
> >>  read all of the online docs and spend countless hours reading through
the
> >>  archives..
> >>
> >>  I'm running PHP4 and Apache on my Win95 computer.
> >>  I'm trying to connect to a remote Oracle database.
> >
> >I had the same problem last week.  Every suggestion I got was about
> >environment variables.   However since a tnsping from within PHP
> >(using passthru) works fine I know better.  From examining the sqlnet
> >files and watching the resource allocations I came to the conclusion that
> >PHP is hardcoded to connect only to a database located on the same
> >machine (using BEQLOCAL).  Oracle never even bothers to read the
> >tnsnames.ora file when its called from PHP.  This seems to be only a
> >problem in Windows and possibly only with the Oracle8 drivers.
> >
> >My postings to the dev lists went unanswered but at the time I was unsure
> >if it was a Windows only problem.  It might be worth reposting this info
> >to the PHP-WIN list.
> >
> >My boss was very unhappy when I told him my code had to run on a Unix
> >box.. I basically sold him on PHP due to is cross-paltform nature.
> >
> >ODBC might work instead, although it never did for me. Use ADODB or
> >another abstraction layer.. this way you can switch back and forth
easier.
> >
> >Let me know if you figure anything else out.
> >
> >Mark Farver
> >[EMAIL PROTECTED]
> >
> >On Thu, 8 Feb 2001, Jorge Santos wrote:
> >
> >>  Hi all,
> >>
> >>
> >>  I'm getting a "Warning: _oci_open_server: ORA-12203: TNS:unable to
> >>connect to destination ..." error message. Yet I know the
> >>environment is ok because I can tnsping the database name and I can
> >>connect using SQL Plus to the database.
> >>
> >>  Here's the php code:
> >>
> >>   >>   putenv("ORACLE_SID=MDC6");
> >  >  putenv("ORACLE_HOME=D:\PROGRA~1\ORAWIN95");
> >>   putenv("TNS_ADMIN=D:\PROGRA~1\ORAWIN95\NET80\ADMIN");
> >>
> >>   $tns = "(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL
> >>=TCP)(HOST = njnwkora15.db.pseg.com)(PORT = 1527)))  (CONNECT_DATA
> >>= (SID =MDC6) ) )";
> >>
> >>   $connect=OCIPLogon("MDC","MDC",$tns) or die("It's not possible to
> >>connect");
> >>
> >>   $sql = "select * from district";
> >>
> >>   $result =OCIParse($connect,$sql);
> >>   OCIExecute($result) or die("It's not possible to query");
> >>
> >>   echo("");
> >>   while(OCIFetch($result)) {
> >>   $CC = OCIResult($result,1);
> >>   $CCNome = OCIResult($result,2);
> >>   echo('' . $CC . '' . $CCNome . '');
> >>   }
> >>   echo("");
> &

Re: [PHP-DB] Join Sentences

2001-02-09 Thread Jorge Santos

Hi  Gaby,

Your best bet is to probably place the statements you want into a function.
Then, when the function is called if any one statement fails you simply
return from the function with an error code.

Hope this answer helps you...

--
(No Espanol mas Portugues)
O melhor a fazer e para por as declaracoes numa funcao. Depois quando chamar
a funcao, se alguma declaracao erra, regresse da funcao com um codico
proprio.

Espero que esta resposta lhe pode ajudar.

Later,
Jorge
[EMAIL PROTECTED]
- Original Message -
From: Gaby <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 09, 2001 7:59 AM
Subject: [PHP-DB] Join Sentences


Hi,

( Excuse me for my english )

I wish execute in PHP some consecutives sentences , but if one of them
returns un error, the program must'n execute anyone. I need one set of
sentences that executes the code like one.

I don't know if I explain ... Thanks a lot.
---
Por si acaso alguien me entiende mejor en espaƱol :
Lo que me gustaria es ejecutar un grupo de sentencias como si fueran solo
una



-- 
PHP Database 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-DB] PHP4/Apache on Win95 to remote Oracle

2001-02-08 Thread Jorge Santos

Hi all,

Please help. I'm going maaddd trying to figure this out. I've pretty much read all of 
the online docs and spend countless hours reading through the archives..

I'm running PHP4 and Apache on my Win95 computer. I'm trying to connect to a remote 
Oracle database.

I'm getting a "Warning: _oci_open_server: ORA-12203: TNS:unable to connect to 
destination ..." error message. Yet I know the environment is ok because I can tnsping 
the database name and I can connect using SQL Plus to the database.

Here's the php code:

");
 while(OCIFetch($result)) {
 $CC = OCIResult($result,1);
 $CCNome = OCIResult($result,2);
 echo('' . $CC . '' . $CCNome . '');
 }
 echo("");
?>

I shouldn't need to declase $tns above but I've tried with and without it. I'm also 
including the ORACLE_SID, ORACLE_HOME and TNS_ADMIN variables in the autoexec.bat so 
that they are declared as of machine bootup. I also added them to the httpd.conf for 
Apache configuration like this:

SetEnv ORACLE_SID MDC6
SetEnv ORACLE_HOME D:\PROGRA~1\ORAWIN95
SetEnv TNS_ADMIN D:\PROGRA~1\ORAWIN95\NET80\ADMIN


Please help Before I switch to ASP...
Later,
Jorge
[EMAIL PROTECTED]