AW: [PHP-DB] PHP: Good for articles?

2001-03-08 Thread Matthias Kopolt

>Another Question: Can users via PHP update field data in a MySQL database?
>I would really appreciate any comments.

PHP and MySQL (at standard ISPs) is a good (the best) choice for your
business.
It's cheap, fast and reliable, although i would not take my mission critical
parts
to an ISP.

check out:
http://www.phpwizard.net/projects/phpMyAdmin/

phpMyAdmin is a DB-Manager for MySql completely written in PHP.

You can do everything with that and so can you with your PHP-Script


mk


-- 
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] 1 TNS error out of 25 connections

2001-03-08 Thread Matthias Kopolt

HI

I have a strange behaviour of my remote Apache-PHP-Oracle-Client.
Apache 1.3.14 mod SSL
PHP  4.0.3pl1   (everything compiled from sources)
Oracle 8.1.6 on remote Intel/Redhat 6.2 (100MBit, same subnet)

The Oracle Server runs a Multi-Threaded-Server (successfully) and accepts
dedicated Serverconnections on the same Port.

tnsnames.ora and sqlnet.ora are placed in the proper directories.
it works in 95% of all requests, but sometimes (with no specific traffic
reason or network problem) it shows an typical _oci_openserver_error: COULD
NOT RESOLVE SERVICE NAME.

I looked up Oracles Online Help but it's just like check your tnsnames.ora,
check your servicename ... But as it works in 95% of all cases, I do not
think that the problem is my path to tnsnames.ora


Is there anyone that is familiar with that problem or the configuration of
MTS and Dedicated at the same port / time ?

thank you

mk



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




AW: AW: [PHP-DB] Oracle Function Calls

2001-03-07 Thread Matthias Kopolt

Oracle Divides Function in several Groups

DML means Data-Manipulating function;

(in your funciton is a update or insert)

to use a function in a query it needs to be "pure" only selects and
arithmetics

you can rewrite this function to a procedure and return your value as an out
parameter

$stmt = ociparse($dbh,"BEGIN p_foo_procedure('param_in',:1);END;" );
OCIBindByName   ($stmt,":1",&$outparam,40);
ociexecute  ($stmt);
OCIfreestatement($stmt);

40 is the buffer in chars/bytes (addjust if needed)

the procedure needs to declare the second argument as in and can declare the
second one as "out" or "in out"

mk

-Ursprungliche Nachricht-
Von: Richard S. Crawford [mailto:[EMAIL PROTECTED]]
Gesendet: Mittwoch, 7. Marz 2001 22:46
An: [EMAIL PROTECTED]
Betreff: Re: AW: [PHP-DB] Oracle Function Calls


Here is the error that I get when I try this approach:

ORA-14551: cannot perform a DML operation inside a query



At 10:26 PM 3/7/01 +0100, Matthias Kopolt wrote:
>YOu have to form proper SQL-Statements
>
>try to parse and execute:
>
> select foo_function ('paramstr', 999) from dual;
>
>dual is a dummy table;
>
>then fetch the resultrow and  ociresult($stmt, 1) will return your
>functionreturnvalue
>
>
>mk
>
>-Ursprungliche Nachricht-
>Von: Richard S. Crawford [mailto:[EMAIL PROTECTED]]
>Gesendet: Mittwoch, 7. Marz 2001 22:11
>An: [EMAIL PROTECTED]
>Betreff: [PHP-DB] Oracle Function Calls
>
>
>Ah!  My bad!  I sent this question out with the wrong subject line.  My
>apologies to everyone that I confused.
>
>
>At 01:07 PM 3/7/01 -0800, Richard S. Crawford wrote:
>
>
> >I desperately need to know whether it is possible to call an Oracle
> >function in PHP.  For example...
> >
> >$functionResult=hubins($name,$commit_yn)
> >
> >where hubins is a stored procedure in our Oracle database.
> >
> >Can this be done?  My first thought was to do something like this:
> >
> >$functionCall="hubins($name,$commit_yen)";
> >
> >then then do
> >
> >ociexecute($functionCall);
> >
> >...but that, of course didn't work.
> >
> >Any thoughts?
> >
> >
> >--
> >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]
> >
>
>--
>http://www.mossroot.com/index.php
>AIM Handle: Buffalo2K
>e-mail: [EMAIL PROTECTED]
>"When you lose the power to laugh at yourself, you lose the power to think
>straight."  --Clarence Darrow
>
>
>--
>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]

--
http://www.mossroot.com/index.php
AIM Handle: Buffalo2K
e-mail: [EMAIL PROTECTED]
"When you lose the power to laugh at yourself, you lose the power to think
straight."  --Clarence Darrow


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




AW: [PHP-DB] Oracle Function Calls

2001-03-07 Thread Matthias Kopolt

YOu have to form proper SQL-Statements

try to parse and execute:

select foo_function ('paramstr', 999) from dual;

dual is a dummy table;

then fetch the resultrow and  ociresult($stmt, 1) will return your
functionreturnvalue


mk

-Ursprungliche Nachricht-
Von: Richard S. Crawford [mailto:[EMAIL PROTECTED]]
Gesendet: Mittwoch, 7. Marz 2001 22:11
An: [EMAIL PROTECTED]
Betreff: [PHP-DB] Oracle Function Calls


Ah!  My bad!  I sent this question out with the wrong subject line.  My
apologies to everyone that I confused.


At 01:07 PM 3/7/01 -0800, Richard S. Crawford wrote:


>I desperately need to know whether it is possible to call an Oracle
>function in PHP.  For example...
>
>$functionResult=hubins($name,$commit_yn)
>
>where hubins is a stored procedure in our Oracle database.
>
>Can this be done?  My first thought was to do something like this:
>
>$functionCall="hubins($name,$commit_yen)";
>
>then then do
>
>ociexecute($functionCall);
>
>...but that, of course didn't work.
>
>Any thoughts?
>
>
>--
>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]
>

--
http://www.mossroot.com/index.php
AIM Handle: Buffalo2K
e-mail: [EMAIL PROTECTED]
"When you lose the power to laugh at yourself, you lose the power to think
straight."  --Clarence Darrow


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




AW: [PHP-DB] Re: sessions

2001-02-23 Thread Matthias Kopolt

configure apache with modrewrite and configure it
to rewrite a request URL like

http://domain/DUMMY/1234109809--cookiedata---123412341234/file

to localfile url

/home/apache/triggeredpath/file


or use one php-file for your total website (maybe modular with includes),
then you can build URLS like

file.php/cookiedata/balbladf?param=adfa

the /cookiedata.. part will be stored in $PATH_INFO and $param will be set t
adfa (just as you know it) (note:things may defer if your using php as cgi)



-Ursprüngliche Nachricht-
Von: Hoover, Josh [mailto:[EMAIL PROTECTED]]
Gesendet: Freitag, 23. Februar 2001 15:00
An: 'Pankaj Ahuja'; php-db list
Betreff: RE: [PHP-DB] Re: sessions


Configure PHP with this line included --enable-trans-sid  This will
automatically put the session ID after every URL if the user does not have
cookies enabled.

Josh Hoover
KnowledgeStorm, Inc.

Searching for a new IT solution for your company? Need to improve your
product marketing?
Visit KnowledgeStorm at www.knowledgestorm.com to learn how we can simplify
the process for you.
KnowledgeStorm - Your IT Search Starts Here


> This could be because cookies have been disabled. Can I
> find a way such
> that my code works even if cookies have been disabled ??



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




AW: [PHP-DB] SELECT problem (2)

2001-02-22 Thread Matthias Kopolt

look at your produced HTML-Code.

it may produce something like


I#M not sure if this is what you wanted to produce

echo("");

this would be more suitable


-Ursprungliche Nachricht-
Von: Julio Cuz, Jr. [mailto:[EMAIL PROTECTED]]
Gesendet: Donnerstag, 22. Februar 2001 22:36
An: [EMAIL PROTECTED]
Betreff: [PHP-DB] SELECT problem (2)


Hi--

Sorry, I forgot to finish the previous e-mail:  What's wrong with this line?

echo("");

I'm trying to RELOAD the current page with the new value of "$campus" after
the user selects a campus from a drop-down menu.  But I can't get the
"this.value" line to pass the value of "$campus" to the new loaded page.

Help!



Julio Cuz, Jr.
Riverside Community College
[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]




AW: [PHP-DB] SQL Select statement

2001-02-17 Thread Matthias Kopolt

>think you can give your problem another approach, splitting it in two
>queries and joining the result sets through php script.

>Sometimes you can't put SQL to do all the work.

That's true, but in most cases it is more efficient to leave the joins,
orders etc. in the DB, because its more optimzed for such dumb processes ...

mk


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




AW: [PHP-DB] Security on Windows2000/Nt

2001-02-17 Thread Matthias Kopolt

>I am using windows2000 and when I run php it enables anyone on my network
>to allow php coding to make directorys in my computer..
>How can I disable this feature so they can only make directorys/files in
their own directory?

You could try to run php in secure mode (not sure if this helps you with
your problem)

or

you could try to have the Webserver run as a special user und then restrict
access and privileges
for that user to your drives and directories (no read, no listing, no
execution, no write, no create ...,
2000 realy has a giant of privileges (per directory, group and user) ...

mk


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




AW: [PHP-DB] SQL Select statement

2001-02-16 Thread Matthias Kopolt

try something like:

select a.memberID from table a, table b where a.choice=2 and b.choice=3 and
a.memberID = b.memberID;

or

select memberID, count(*) from table where choice=2 or choice=3 group by
memberID having count(*) = 2;

(i don't know what is more effizient, might depend on your indexes and the
amount. the second sql asumes you only have one row per memberID - choice
(noone should choose 3 2times ore more)

mk

-Ursprungliche Nachricht-
Von: bill [mailto:[EMAIL PROTECTED]]
Gesendet: Samstag, 17. Februar 2001 02:45
An: [EMAIL PROTECTED]
Betreff: [PHP-DB] SQL Select statement


I have a table with three simple columns: id(unique), memberID, and
choice


I want to find out which memberIDs have BOTH choice 2 AND choice 3.

--> SELECT memberID from table where choice=2 AND choice = 3

That won't work (0 results, of course, because no row has two choices,
they're mutually exclusive)

---> SELECT memberID from table where choice=2 OR choice = 3

That doesn't work (shows all memberIDs that chose either 2 or 3).

Can I maybe join the table upon itself on the memberID?

Other suggestions?

thanks,

bill hollett


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




AW: [PHP-DB] OCI8 error problems

2001-02-14 Thread Matthias Kopolt

>   Warning: OCIStmtExecute: ORA-1: unique constraint (CUSTOM.SYS_C007900)
violated ORA-06512: at
>"CUSTOM.MULT_SHIP_ADDRESS_PKG", line 162 ORA-06512: at line 1 in db.php on
line 344

this has nothing to do with PHP, this is your personal DB-Problem ;-)

A "constraint" is a DB-Rule that keeps you from producing invalid or
senseless records. You normaly set them explicitly or be declaruing columns
as unique or by disallowing null values.

In this case you violated a "unique constraint" maybe you're inserting twice
the same record, or there is already a record with the same id or ... you
can investigate your Table defintions or search the DB with tool for the
constraintsname CUSTOM.SYS_C007900 if you dont have a clue what you are
violating.

I'd guess your MULT_SHIP_ADDRESS_PKG is already used ...

mk


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




AW: [PHP-DB] Oracle, Stored Procedure Out Variable confusion

2001-02-14 Thread Matthias Kopolt

>please create the shortest possible testcase that
>demonstrates your problem and send it to the list.

you need a PL/SQL stored procedure

like

CREATE PROCEDURE "SCHEMANAME"."P_TEST" (p_error out number) IS
BEGIN
  p_error := 0;
END p_test;

than run a php script connecting to db and quering

$stmt = ociparse($dbh,"BEGIN P_TEST(:1);END;" );
OCIBindByName   ($stmt,":1",&$error, 4);
ociexecute  ($stmt);

if ($error == 0) { echo "equal"; }
else { echo "not equal"; }


after pressing about 20 times the reload button you will notice that both
branches of the if are reached
"$error" == "0" will deliver the right decision.

(I already tried to initialize $error before binding, but it had no
influence...)

mk


-- 
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] Oracle, Stored Procedure Out Variable confusion

2001-02-14 Thread Matthias Kopolt

confusion:

Using PHP 4.0.3pl1 with oci8 libraries and Oracle 8.1.6 there seems to be
problem when retrieving OUT-Variables from stored procedure, bind to a
variable.

for example i got an error retrun value (parsed to SQL as :1 and bind to
$error with a buffer of 4) it could !! happen that $error looks like 0
[zero] but is not a [zero] but something else sometime $error == 0 is true,
sometimes it false ...

WOrkaraund: using it as a string helped "$error" == "0" is always true when
$error looks like a zero. there is no sign of some extra spaces or invisible
chars. strlen is always 1 and print always prints 0. But sometimes zero
isn#t less enough ... ;-)

Did someone else face this problem or do you know if this is fixed in later
releases or if this a special NET8 remote DB on linux and client on solaris
problem ?

mk


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




AW: AW: AW: AW: [PHP-DB] php and OCI

2001-02-14 Thread Matthias Kopolt

MAYBE THERES ANOTHER WAY; but before selecting or fertching all you wont
know


Are you saying that, in php, every query has to be perfomed twice, if you
want
to know the number of rows in selection (before the fetch loop)?


Matthias Kopolt wrote:

> OK:
>
> imagine you want to find all rows where COLOR = 'foo' :
>
> $st1  = ociparse  ($conn, "SELECT count(*) FROM myTable WHERE COLOR =
> 'foo'");
> ociexecute($st1,OCI_DEFAULT);
> ocifetch  ($st1);
> $number_of_rows = ociresult ($st1, 1);  //e.g. 372
>
> $st2  = ociparse  ($conn, "SELECT ID, NAME FROM myTable WHERE COLOR =
> 'foo'");
> ociexecute($st2,OCI_DEFAULT);
> while (ocifetch($st2)) {
> echo " ID   : ".ociresult ($st2, 1);
> echo " NAME : ".ociresult ($st2, 2);
> } //this will return about 372 datarows
>
> $st3  = ociparse  ($conn, "SELECT ID, NAME FROM myTable WHERE COLOR =
'foo'
> AND ROWNUM <= 10");
> ociexecute($st1,OCI_DEFAULT);
> while (ocifetch($st3)) {
> echo " ID   : ".ociresult ($st3, 1);
> echo " NAME : ".ociresult ($st3, 2);
> } //this will return max 10 datarows
>
> //remember to ocifreestatement($st..) every ressource when duing continuos
> queries
>
> /*
> rownum is a metacolumn that is a signed during retrieving data from
> database, but before sorting it.
> so " where rownum < 11 order by points desc " will not give you the top
ten
> but, the first 10 entries in the list, ortderd by points.
>
> to overcom that do subselects :
>  "select * from (select * from table where foocondition order by foo)
where
> rownum < 10 "
>
> mk

--

==
Valerio FerrucciTabasoft Sas
[EMAIL PROTECTED]  http://tabasoft.ancitel.it
[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]




AW: [PHP-DB] RE: problems with require...

2001-02-14 Thread Matthias Kopolt

> I have only started to program in php over the past month or so.
> but I'm some problems with this bit of code below.
>
> Problem area
>  require('$includefile.inc');

use " instead of ' because within ' the $variable will not get resolved


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




AW: AW: [PHP-DB] php, OCI and datatypes

2001-02-14 Thread Matthias Kopolt

Is source and output from one try? because the number of rows doesn't match

a problem could be the NLS-SETTINGS of your DB,
maybe they are set to a character set that uses
2 Bytes per char.

Or yust PHP has a problem to handle CHAR - columns.
maybe you can overcome that with some type conversions.

Either try something like to_char () or substring () in SQL:

select to_char (colname)   //i#m not sure if that works
select substr  (colname,1) // or zero, don't know if character counting
starts with 0 or 1

 or
cast the result values :

$col_1 = (string) ociresult($stmt, "CHAR_COL");


mk

-Ursprüngliche Nachricht-
Von: dsi safir [mailto:[EMAIL PROTECTED]]
Gesendet: Donnerstag, 14. Februar 2002 11:13
An: [EMAIL PROTECTED]
Betreff: Re: AW: [PHP-DB] php, OCI and datatypes


The "Hello" example (" H e l") comes from the sourcecode of
my browser.
What's strange is that the two browsers (Netscape 4.03Fr and
IE 5.0) have different source code for the same page.

It do seems that each CHAR that I manage to fetch is coded
with two places (in IE).

I tried the following code for example with the same result

Nice Title, isn't
it\n";
$conn = OCILogon("X", "Y", "ZZZBASEZZZ");
$stmt = OCIParse($conn, "select CHAR_COL,
OTHER_DATATYPE_COL from CODE_FICHIER");
OCIExecute($stmt);
// I fetch the five first rows
for ($i = 0; $i < 5; $i++) {
ocifetch($stmt);
$col_1 = ociresult($stmt, "CHAR_COL");
$col_2 = ociresult($stmt, "OTHER_DATATYPE_COL");
echo("\"$col_1\"\t\"$col_2\"\t\n");
}

echo ("");
?>
The html source is :
le titre
" " "308"
" A B C""626"
" " "702"
" A A N""1108"
" " "1109"
" 7 5 1""1112"
""  ""
""  ""



I will have a look at the HTTP header (Content-Language or
mime-type...), who knows

Matthias Kopolt a écrit:
>
> use the display sourcecode function of your browser, it is more reliable
> than the output.
>
> try to get the char column with
>
> ocifetch($stmt); $charcol = ociresult($stmt, "nameofcharcol");
>
> maybe your using [] the wrong way so you are getting the chars of the
string
> instead of the strings in the row
>
> mk
>
> -Ursprungliche Nachricht-
> Von: dsi safir [mailto:[EMAIL PROTECTED]]
> Gesendet: Donnerstag, 14. Februar 2002 10:23
> An: [EMAIL PROTECTED]
> Betreff: [PHP-DB] php, OCI and datatypes
>
> Hi,
>
> I'm working with Oracle 8.05 and php4.04xx.
> I'm selecting some datas in order to show them in a browser
> (Netscape 4.03Fr or IE5.0).
>
> I found out that my code works well with all datatypes but
> CHAR.
> Varchar2, date or numbers are retrieved and rendered in an
> array without any problems.
> With a char column, I can't see any values with Netscape and
> with IE, I have less than half
> of the string or nothing.
>
> Example : select char_column, other_column from my_table; //
> the query, char_column as a char(5) not null
>
> The output with OCIFetchStatement or OCIFetchInto or else is
> made with something like $data[$i].
> The char column is filled with a blank space on the first
> row.
> On the second row, the char column is filled with a blank
> space between half of the initial string.
> and so on...
> Example : for "Hello" in the table, I get " H e l".(with IE,
> with Netscape I get nothing at all).
>
> So, any ideas ?
>
> Emmanuel Nectoux
>
> --
> 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]


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




AW: [PHP-DB] How can I have connection pooling in PHP?

2001-02-14 Thread Matthias Kopolt

you can use persistent connections or you can have the db-Environment do
that for you, e.g. COnnectionManager or ConenctionPooling of oracles NET8

mk

-Ursprüngliche Nachricht-
Von: Christopher Cheng [mailto:[EMAIL PROTECTED]]
Gesendet: Mittwoch, 14. Februar 2001 11:27
An: [EMAIL PROTECTED]
Betreff: [PHP-DB] How can I have connection pooling in PHP?


I am wondering whether I can have connection pooling in PHP like Java?



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




AW: [PHP-DB] php, OCI and datatypes

2001-02-14 Thread Matthias Kopolt

use the display sourcecode function of your browser, it is more reliable
than the output.

try to get the char column with

ocifetch($stmt); $charcol = ociresult($stmt, "nameofcharcol");

maybe your using [] the wrong way so you are getting the chars of the string
instead of the strings in the row

mk


-Ursprungliche Nachricht-
Von: dsi safir [mailto:[EMAIL PROTECTED]]
Gesendet: Donnerstag, 14. Februar 2002 10:23
An: [EMAIL PROTECTED]
Betreff: [PHP-DB] php, OCI and datatypes


Hi,

I'm working with Oracle 8.05 and php4.04xx.
I'm selecting some datas in order to show them in a browser
(Netscape 4.03Fr or IE5.0).

I found out that my code works well with all datatypes but
CHAR.
Varchar2, date or numbers are retrieved and rendered in an
array without any problems.
With a char column, I can't see any values with Netscape and
with IE, I have less than half
of the string or nothing.

Example : select char_column, other_column from my_table; //
the query, char_column as a char(5) not null

The output with OCIFetchStatement or OCIFetchInto or else is
made with something like $data[$i].
The char column is filled with a blank space on the first
row.
On the second row, the char column is filled with a blank
space between half of the initial string.
and so on...
Example : for "Hello" in the table, I get " H e l".(with IE,
with Netscape I get nothing at all).

So, any ideas ?

Emmanuel Nectoux

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




AW: AW: AW: AW: [PHP-DB] php and OCI

2001-02-13 Thread Matthias Kopolt

>and to get rows, say, from 20 to 40?
>Is it ok to write:
>"select * from (select * from table where foocondition order by foo) where
>rownum >= 20 AND rownum <= 40"

its not that easy, as oracle start counting with the first retrieved row, so
rownum > x will wait for ever, as oracle will never start counting because
no
rows are retrieved.

make a trick and select the rownum in a subquery, than you can treat it as a
fixed row:


select * from (
select rownum "rn", * from (select * from table where foocondition order by
foo)
  )
where rn >= 20 AND rn <= 40


this should do it (although there are a lot of subqueries)


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




AW: AW: AW: [PHP-DB] php and OCI

2001-02-13 Thread Matthias Kopolt

OK:

imagine you want to find all rows where COLOR = 'foo' :

$st1  = ociparse  ($conn, "SELECT count(*) FROM myTable WHERE COLOR =
'foo'");
ociexecute($st1,OCI_DEFAULT);
ocifetch  ($st1);
$number_of_rows = ociresult ($st1, 1);  //e.g. 372


$st2  = ociparse  ($conn, "SELECT ID, NAME FROM myTable WHERE COLOR =
'foo'");
ociexecute($st2,OCI_DEFAULT);
while (ocifetch($st2)) {
echo " ID   : ".ociresult ($st2, 1);
echo " NAME : ".ociresult ($st2, 2);
} //this will return about 372 datarows


$st3  = ociparse  ($conn, "SELECT ID, NAME FROM myTable WHERE COLOR = 'foo'
AND ROWNUM <= 10");
ociexecute($st1,OCI_DEFAULT);
while (ocifetch($st3)) {
echo " ID   : ".ociresult ($st3, 1);
echo " NAME : ".ociresult ($st3, 2);
} //this will return max 10 datarows


//remember to ocifreestatement($st..) every ressource when duing continuos
queries


/*
rownum is a metacolumn that is a signed during retrieving data from
database, but before sorting it.
so " where rownum < 11 order by points desc " will not give you the top ten
but, the first 10 entries in the list, ortderd by points.

to overcom that do subselects :
 "select * from (select * from table where foocondition order by foo) where
rownum < 10 "


mk


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




AW: [PHP-DB] php and OCI

2001-02-13 Thread Matthias Kopolt

you can use the meta column rownum

e.g. where rownum<20

note: you need to do subselects and (where rownum > 1) will never return a
line !!!

you could use something like

select * from

select rownum "rownumber", mydata from mytable order by
mycol
  ) where rownumber > 10 and rownumber < 20;

should work ...

2. i know there is a phpfunction for that ocifetchedrows or something like
that

mk


-Ursprungliche Nachricht-
Von: Valerio Ferrucci [mailto:[EMAIL PROTECTED]]
Gesendet: Dienstag, 13. Februar 2001 12:54
An: [EMAIL PROTECTED]
Betreff: [PHP-DB] php and OCI


Hi,
I'm using php with oracle to select data in a db.
1)
My code is:
putenv("ORACLE_HOME=/xx");
putenv("ORACLE_SID=xx");
$conn = ociLogon("xx","xx","xx");
$st = ociparse($conn,"select * from myTable order by MYFIELD");
$res = ociexecute($st,OCI_DEFAULT);

while(ocifetch($st))
{
...
}

This is ok, BUT:
I want to show records in pages with 20 records each one. How can I
obtain this?
I see that php asks all thousands records to (remote) oracle server,
slowing time. Is there something like:
ociexecute($st,OCI_DEFAULT, fromRec, toRec);

2)
How can I know the total records in current selection?

Thanks

==
Valerio FerrucciTabasoft Sas
[EMAIL PROTECTED]  http://tabasoft.ancitel.it
[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]


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




AW: AW: [PHP-DB] Oracle connectivity

2001-02-13 Thread Matthias Kopolt

ok, you're right, seems like windows versions are not as compatible as the
unix/linux ones.
anyway, there must be a way.

my ideas are setting up those environment variables (ORACLE_HOME ORACLE_BASE
ORACLE_TAB in the APACHE, and maybe some more (look at the environmental
table or the administrators/installation guide for the Client at
technet.oracle.com)

make your tnsnames.ora and sqlnet.ora clean, that means, only really
necessary entries and only one TNSNAME.
Delete or Rename all copies of TNSNAMES.ORA and SQLNET.ORA.
try to add  (SERVER=DEDICATED)  into to  (CONNECT_DATA = (SID =
ORCL)(SERVER=DEDICATED)) part of name definition.

check the oci-section of PHPINFO() to check to compiletime ORACLE_HOME,
maybe it helps to reinstall or copy the Client to that location. (since
under linux i build it from source and --with-oci=$ORACLE_HOME)

Can you compile the win32 binary from src? I never did this, seems to be
difficult, hu?

mk



>Are you using PHP under windows with Oracle?  PHP and Oracle work
>correctly under Unix.. but the Windows people are having loads of trouble,
>and I've yet to meet anyone who had it working.

>Mark Farver


Matthias Kopolt


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




AW: [PHP-DB] Oracle connectivity

2001-02-12 Thread Matthias Kopolt

http://www.php.net/manual/en/function.ocilogon.php

tells you

int OCILogon (string username, string password [, string db])

so i assume that TEST is your User, web the password and pwd the
TNS-Identifier ?

I have a 8.1.6 DB (i guess thats what you have too), i#m using OCI8 libaries
and connecting to that remote server from more than 10!! different Machines
on the network, using PHP, JDBC and various Management Tools. It does work
believe me - Although sometimes it is difficult to set it, since there are
quite a few things that can go wrong.

the TNS names must match, (consider that a default_DOmain might be added
(sqlnet.ora))
the IP and Port of the remote DB have to match, as well as the Service or
the SID

ORACLE_HOME and sometimes some other ORA-Eniironments have to be set inside
apache or PHP or by explicity call.


mk


-Ursprüngliche Nachricht-
Von: Randall Barber [mailto:[EMAIL PROTECTED]]
Gesendet: Montag, 12. Februar 2001 18:37
An: [EMAIL PROTECTED]
Betreff: [PHP-DB] Oracle connectivity


There was a post a few days ago here that indicated that PHP could only talk
to Oracle databases if they resided on the same machine as the script
because PHP could not deal with the TNS resolutions or something to that
nature.

I have an Oracle database that I need to connect to on another machine (I'll
call it LIVE).

The tnsnames.ora has the appropriate entry in it for TNS resolution to an IP
connected database.
I used Net8 to create the DSN mapping.

When I use,
OCILogon("TEST","web","pwd");
I get a TNS resolution error (which I was able to FINALLY overcome), and now
I get "Could not connect to remote host." type error.

I am running WinNT 4.0 w/IIS, PHP4.

Now the reason I think its PHPs problem is because I can connect to the
database using ASP and VBScript.
I BELIEVE (not certain), that the client version I am running is 8.0.1.6.  I
am "assuming" (yikes) that the phpoci.dll is the one I needed, not the
phporacle.dll.  I have tried both and receive similar errors.  Even using
the ODBC component of PHP returns similar errors as above.

Any suggestions are welcome.
RDB


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




AW: [PHP-DB] array_count_values

2001-02-06 Thread Matthias Kopolt

what is your complete line ?

maybe your counting environmental var that is not present in cronjob
execution


mk

-Ursprungliche Nachricht-
Von: Rahul Hari Bhide [mailto:[EMAIL PROTECTED]]
Gesendet: Dienstag, 6. Februar 2001 12:50
An: [EMAIL PROTECTED]
Betreff: [PHP-DB] array_count_values


Gurus,
I am fetching an array from an Oracle database . I get the following
warning  message for a particular set of results only .
--
Warning:  Can only count STRING and INTEGER values! in
/tmp/myscript.php on line 36
--
The line 36 as mentioned in above warning has array_count_values function
used
on it .

I am running php script as a cron job. Also the resultant html file shows
accurate results.

Any ideas why and when does this warning comes up???.

thanks in advance,

~R



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




AW: [PHP-DB] Oracle TNS problems with PHP4?

2001-02-02 Thread Matthias Kopolt

>How many of you have Oracle working with PHP4?  What version of the Oracle
>drivers?  Are you accessing a local db or a remote one?  Did you have to
>tweak any settings to make it work?  Windows or Unix?

PHP 3.0.16 / PHP 4.0.3
ORACLE 8.1.6

Remote + Local

No Problems with the "TNS No Service".

Some Hints:
- run it on UNIX or Solaris
- ORACLE_PATH is also important to the client, since needs to know how to
find the tnsnames.ora
- A "no Service" is normaly related to the server side of the connection
= your general local config is ok
= the db server could be connected
= the listener is up, but it doesn't know where to deliver your call
= check the SID/Service etc. parameters of your tnsnames.ora

mk



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




AW: [PHP-DB] Oracle Persistant Connections

2001-02-01 Thread Matthias Kopolt

Yes, same question. The only thing i know about, is that, if you are running
php not ass an module, your connection will die right ever script executing
therefore making OCIPLogon = OCILogon.

If run as module the connection will last till your server thread is
regenerated. Therefore it can have a very dark side effect if the
connections are not reliable reused: imagine 250 Apache Spawns with each
hundreds of OCI-COnnections still open ...
be carefull!

And this is exactly my problem. I can not try tghis since the machine is
running heavy traffic unless i know at leasst the theory

Another Idea of reduicing Logon overhead is to run the server in MTS - Mode
which does not cause the Oracle Server to start an dedicated ServerProcess
for every Logon/Session.

Well, suggestions please ;-)

mk


-Ursprüngliche Nachricht-
Von: Serge Paquin [mailto:[EMAIL PROTECTED]]

I am using Oracle8i and want to make a little php script that will be run a
huge amount of times (i hope ).  PHP has the OCIPLogon for persistent
connections and am wondering the details of how it works.

I want the php script to run a simple insert then select statement and would
like to avoid a huge logon penalty that comes with creating a new session
to oracle since the life of the program is very short and the frequency
very very high (again I hope).


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




AW: [PHP-DB] Limit number of persistent oci8-connections?

2001-01-25 Thread Matthias Kopolt

MaxClients in httpd.conf reduces your total server performance in case you
have not only db-actions but also images and plain files ...

if you use something other than ocilogon you open a persistant link that
might not be closed. (try using ocilogon instead of eg ociplogon)

close every connection with ocilogoff

If you are running heavy traffic try to configure your NET8 Listener to work
as MTS. This does not create and destroy a process every time you query the
server, but delivers all incoming queries to some worlking-server-processes,
starting and stopping them when needed, just like apache handles its childs.

Increase the Global System Area by incresing the Shared Pool Size of your DB
: this will inspire the db to consume more caching ram. On the other site
check the ram consumption of oracle... maybe it swaps!

If you want to limit your PHP-Scripts connections there is the problem with
the synchronisation of the counter: sessions, a file, shared memory/IPC
System V. It all doesn't sound very satisfing.

Maybe you can place your db-phpscripts into a virtual host or another apache
and configure that with a lower maxCLients directive, but this will simply
lock out your visitors not giving you a chance to intercept the error
message.

Another Idea: can you limit the number of concurrent sessions created by one
DB-User ? if possible you could assign your scripts a special user and
therefore allowing connections with higher priority from e.g. your admin
account


> On Thu, Jan 25, 2001 at 08:22:07PM +0100, Matthias Kopolt wrote:
> > Are you useing persistent connections (I had no real luck
> with them)?
> >
> > How do you connect to your DB over Multi Threaded Server
> (MTS) or Dedicated
> > Server ?
>
> I am just using phplib for the dirty stuff :) So I don't know
> exactly how
> this works under the hood..
>
> > I think Oracles NET8 Config has a Parameter to limit this.
> > Check out the MasterIndex at
>
> Well it is limited to 200 connections right now, but I would
> like to limit
> that on the PHP side rather than on the Oracle side. Although I don't
> exactly know why. It just seems right :)


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




AW: [PHP-DB] Limit number of persistent oci8-connections?

2001-01-25 Thread Matthias Kopolt

Are you useing persistent connections (I had no real luck with them)?

How do you connect to your DB over Multi Threaded Server (MTS) or Dedicated
Server ?

I think Oracles NET8 Config has a Parameter to limit this.
Check out the MasterIndex at

http://technet.oracle.com/doc/server.815/a68826/toc.htm

mk



> -Ursprüngliche Nachricht-
> Von: Karsten Dambekalns [mailto:[EMAIL PROTECTED]]
> Gesendet: Donnerstag, 25. Januar 2001 20:09
> An: PHP Database
> Betreff: [PHP-DB] Limit number of persistent oci8-connections?
>
>
> Hi!
>
> I am using PHP to connect to an Oracle 8.1.5 database.
> Everything works
> fine, but the load on the oracle server is insanely high. So
> I would like to
> limit the number of connections. Is there something like the mysql
> max_persistent_connections statement?
>
> TIA,
> Karsten
>
> BTW: Has some used sqlrelay and would like to share the experience?
> --
> Why do we have to hide from the police, daddy?
> Because we use emacs, son. They use vi.
> -
> mailto:[EMAIL PROTECTED] w³: http://www.k-fish.de/
> gpg: http://www.k-fish.de/mykeys.gpg
>


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




AW: [PHP-DB] PHP PopUp Window

2001-01-24 Thread Matthias Kopolt

This is not exactly a DB-Problem but:

>   What I'm trying to do is after a user submits a form,
> PHP validates the
> form and if an error open a JavaScript popup window.
> I'm having trouble-getting PHP to either run the JavaScript
> or send the
> information to the browser so it can execute the JavaScript.

Remember that PHP can't execute Javascripts !! it can only produce
javascripts like
$error = "No Name entered";
echo "alert ('Your error is : $error !! ');";

> Also on another note is it possible to hide the search
> portion of a URL that
> is sent using:
> 
>
> I don't like the user seeing the sometimes-long URL that is
> sent using this
> manner.

If you'd needn't the Redirect you could simply POST your formdata instead of
GET. Since you stick on that Location:... try using a frameset around ;-)


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




AW: [PHP-DB] MS-SQL Error Message Replacement

2001-01-24 Thread Matthias Kopolt

So you like to let the SQL check for those constraints and you want only the
PHP to deal with that ugly error:

 - disable the error output by placing @ before your php-function

 - catch the error either by checking $php_errormsg (works only if
error-tracking is enabled) or by the result code or mssql_get_last_message

  - find your keyword and print an adapted message


> I'm working with MS-SQL 7 and IIS 4 as well as PHP4.0.4 ---
>
> My question is that when a message is received while
> attempting to delete a
> row in [table x] while it is tied to [table y.column a] by a
> foreign key
> relationship [see below]
>
> Warning: MS SQL message: DELETE statement conflicted with
> COLUMN REFERENCE
>   constraint 'FK_COMPONENT_INDEX_page'. The conflict occurred
> in database
>'corplan', table 'COMPONENT_INDEX', column 'pid'.
> (severity 16) in D:
>   \Inetpub\wwwroot\admin\intranet.php on line 122
>
>  Warning: MS SQL: Query failed in
> D:\Inetpub\wwwroot\admin\intranet.php on
>  line 122
>
>
>
> How can I put in my own custom message when these errors
> occur?  Should I
> be looking for a failed query message and then acting on
> that?  I like the
> protection that the foreign key relationship enables, because
> you can't
> delete "parent" objects without removing the children first.
>
> I'm sure this really isn't a difficult question, I'm looking for for
> suggestions on how I should approach this.


-- 
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] OCI-24324 in apache error log

2001-01-24 Thread Matthias Kopolt

For some strange reason I get an :
Warning: failed to rollback outstanding transactions!: ORA-24324 : Service handle not 
initialised in ... on line 0

I'm running 4.0.3pl1 as server module with OCI8-support for apache 1.3.14 and had no 
problems with the same script under php3.

After some error() calls and debugging I found it.
If you got this error too check your script for double calls of ocilogogg. For some 
reason the second ocilogoff call is executed after the scripts output to the webserver 
has finished. Therefor the error message is placed only in the apache logfile and not 
on the page.

cu