Re: [PHP-DB] Merge two arrays into associative arrays?

2001-05-22 Thread Shahmat Dahlan

This should have worked but my data are not single characters as I had showed
earlier. Maybe the examples below are clearer.

$a=array(id,svrname,ipadd,domainname,);
$b=array(ID,Server Name,IP Address,Domain Name);

Thanks


Lars B. Jensen, LJ Webnologics wrote:

 Have followed this group for a while, it is my turn to try send an response.

 Would this angle with a for loop not be better than a foreach angle ?
 ?php
  $a = array(1,2,3,4,5);
  $b = array(a,b,c,d,e);
  $c = array();

  $arraysize = sizeof($a);
  for ($i=0;$i$arraysize;$i++) {
   $c[$a[$i]] = $b[$i];
  }
 ?

 / Lars
 www.ljweb.com

 - Original Message -
 From: Jonathan Hilgeman [EMAIL PROTECTED]
 To: 'Shahmat Dahlan' [EMAIL PROTECTED]
 Cc: PHP-DB (E-mail) [EMAIL PROTECTED]
 Sent: Monday, May 21, 2001 6:10 PM
 Subject: RE: [PHP-DB] Merge two arrays into associative arrays?

  try:
 
  $a=array(1,2,3,4,5);
  $b=array(a,b,c,d,e);
  $c = array();
 
  foreach($a as $a_key = $a_value)
  {
  $c[$a_value] = $b[$a_key];
  }
 
  that should give you what you want.
 
  Jonathan
 
  -Original Message-
  From: Shahmat Dahlan [mailto:[EMAIL PROTECTED]]
  Sent: Monday, May 21, 2001 12:23 AM
  To: PHP-DB
  Subject: [PHP-DB] Merge two arrays into associative arrays?
 
 
  Is there anywhere possible for me to merge two arrays into associative
  arrays?
 
  e.g.
  $a=array(1,2,3,4,5);
  $b=array(a,b,c,d,e)
 
  into
 
  $c=array(1 = a, 2 = b, etc... )
 
  Thanks in advance..


-- 
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] about PHP Warning: failed to rollback outstanding transactions!

2001-05-22 Thread Michael Cheung

Hi;

Linux 2.2.18 + oracle 8.1.7i + php 4.0.5 + oci8
I got a warning in log file.
PHP Warning:  failed to rollback outstanding transactions!

I have simplify the script.
it will cause the warning.

function ShowError($errormsg,$dbh=false)
{
if($dbh!=false) OCILogOff($dbh);
exit();
}

$dbh=OCILogon(weboracle,cyber,);
ShowError(Login Error,$dbh);


Regards;
Michael


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

2001-05-22 Thread Russ Michell

Hi all:

I have a simple checking mechanism:

$num = mysql_num_rows($result);
if($num == 0) {
$display_news = pSorry, no news items./p;
}
else {
while(this, that and the other) {
}
}

What's the difference between:
if($num == 0) {
$display_news = pSorry, no news items./p;
}
//and:

if($num != 1) {
$display_news = pSorry, no news items./p;
}

As I seem to remember the former working fine...now I have to switch to 
the latter???

Cheers.
Russ

#---#

  Believe nothing - consider everything   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


-- 
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] Inserting Blob Data

2001-05-22 Thread Xanir

Hi,

I want to insert data in to a blob. So I followed the steps in de docs, but
when I try to execute this script in the IBConsole:


begin declare section;
  based on test.v1 document;
  based on test.v1.segment BlobV1Buffer;
  based on test.state CA;
  unsigned short BlobV1Len;
end declare section;

  declare CursorV1 cursor for insert blob v1 into test;

  open CursorV1 into :document;

  sprintf(BlobV1Buffer, 'First blob tekst');

   BlobV1Len = strlen(BlobV1Buffer);

  insert cursor CursorV1 values (:BlobV1Buffer:BlobV1Len);

  close CursorV1;

insert into test (state,v1) values ('CA',:document);



an error message pops up:


error:

Dynamic SQL Error
SQL error code = -104
Token unknown - line 1, char 0
begin
Statement: begin declare section


How do I solve this problem?


Thanks.



-- 
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] Interbase BLOB Insertion Problem

2001-05-22 Thread Xanir

Hi,

I want to insert data in to a blob. So I followed the steps in de docs, but
when I try to execute this script in the IBConsole:


begin declare section;
  based on test.v1 document;
  based on test.v1.segment BlobV1Buffer;
  based on test.state CA;
  unsigned short BlobV1Len;
end declare section;

  declare CursorV1 cursor for insert blob v1 into test;

  open CursorV1 into :document;

  sprintf(BlobV1Buffer, 'First blob tekst');

   BlobV1Len = strlen(BlobV1Buffer);

  insert cursor CursorV1 values (:BlobV1Buffer:BlobV1Len);

  close CursorV1;

insert into test (state,v1) values ('CA',:document);



an error message pops up:


error:

Dynamic SQL Error
SQL error code = -104
Token unknown - line 1, char 0
begin
Statement: begin declare section


How do I solve this problem?


Thanks.



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




Odp: [PHP-DB] Interbase BLOB Insertion Problem

2001-05-22 Thread Jarek Zgoda

Od: "Xanir" [EMAIL PROTECTED]
Temat: [PHP-DB] Interbase BLOB Insertion Problem


 begin declare section;
   based on test.v1 document;
   based on test.v1.segment BlobV1Buffer;
   based on test.state CA;
   unsigned short BlobV1Len;
 end declare section;

This is DSQL statement, you cann't use it in ISQL!
For detailed description of IB BLOB hadling in PHP go to
www.open-database.de

Cheers
Jarek Zgoda


-- 
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] web to access/excel

2001-05-22 Thread Russ Michell

*Apologies for cross-postings**

Hi there all:

Does anyone know of a product - preferably free, that once 
installed, can take info from an ordinary HTML web based form and 
drop it into an access/excel database/spreadsheet?? or a 
pre-defined/written script or class written for Apache/php4/MySQL that 
has the information filtering and sorting capabilites of excel/access??

One of our departments urgently requires such functionality to increase 
processing times of student enquiries. At present the information from 
the students is in a non-standardised format in the form of an email 
that has to be processed by hand.

The data needs to be formalised from a structured online form, and 
inserted into an access/excel type 'environment' that current 
(non-web technical) administrators are familliar with.

Any suggestions are most welcome.

Again I apologise for the cross posting but this is a pressing matter, 
that requires I find a pointer to a solution, or an actual solution 
as fast as I can!

Kind regards:
Russ



#---#

  Believe nothing - consider everything   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


-- 
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] odbc with ms access

2001-05-22 Thread Dalyyla

hi,

Access to data with ms access via odbc is kinda slow . I would like to
know if it is normal and what can i do to make it faster

Thanks

Dalyyla


-- 
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] Error MSG -410 while executing a select with ifx_query on a informix database on linux

2001-05-22 Thread Robert Hennig

Hi!

We use a informix IDS2000 server  on a linux machine together with php 4.05
on Apache. As a test we wrote the following script:

?php
$conn_id = ifx_connect(unipps,informix,sqLOpen);
if (! $conn_id)
{
  echo connection failed;
}

$ergebnis = ifx_query(select ident_nr from personal, $conn_id);
if(! $ergebnis)
{
  echo selection failed;
}

ifx_htmltbl_result($ergebnis, border=\2\);
ifx_free_result($ergebnis);
echo $ergebnis;
echo $conn_id;
?

The connect seems to work, because we get a syntax error if we use a wrong
field-name in the select. We receive the following error when executing this
script:

Warning: Describe fails (E [SQLSTATE=37 000 SQLCODE=-410]) in
/v/u/robert/public_html/datenbank.php on line 8

(line 8 is the line $ergebnis = ifx_query(select ident_nr from personal,
$conn_id);)

What wents wrong?

Robert






-- 
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] Error MSG -410 while executing a select with ifx_query on a informix database on linux

2001-05-22 Thread Robert Hennig

Hi Paul,

thanks for your fast reply. Maybe you could help me again :-) We are working
a lot with informix, so we thought to know every Programm, but isql is
completely unknown. Is this a special programm?

We have executed this select with a sql-editor on the server also as with
dbaccess, on both it works.

Thanks

Robert

Paul Gardiner [EMAIL PROTECTED] schrieb im Newsbeitrag
001201c0e2ca$730d0c40$0200a8c0@PDG">news:001201c0e2ca$730d0c40$0200a8c0@PDG...
 Hi Robert,

 Your test code is correct although you could do with an
ifx_close($conn_id);
 at the end.

 Have you tried running isql(assuming you've got it) and just trying to run
 the query from there?

 Regards,
 - Paul -




-- 
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] Can't open dbm files with mod_php4-4.0.5_1

2001-05-22 Thread Eric Jan Pot

Hi,

I upgraded my server to Apache 1.3.19/mod-PHP4-4.0.5_1, but now I can not
open my 'older' dbm database files any more.
When I try to configure --with-dbm , I am not able to compile.

Thanks in advance,

Eric Pot



-- 
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] web to access/excel

2001-05-22 Thread Jonathan Hilgeman

Hi Russ,
Try this package:
http://phpclasses.upperdesign.com/browse.html/package/237

You need to register for free to gain access, but this package is supposed
to write Excel binary files. 

Jonathan

-Original Message-
From: Russ Michell [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 22, 2001 5:01 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: [PHP-DB] web to access/excel


*Apologies for cross-postings**

Hi there all:

Does anyone know of a product - preferably free, that once 
installed, can take info from an ordinary HTML web based form and 
drop it into an access/excel database/spreadsheet?? or a 
pre-defined/written script or class written for Apache/php4/MySQL that 
has the information filtering and sorting capabilites of excel/access??

One of our departments urgently requires such functionality to increase 
processing times of student enquiries. At present the information from 
the students is in a non-standardised format in the form of an email 
that has to be processed by hand.

The data needs to be formalised from a structured online form, and 
inserted into an access/excel type 'environment' that current 
(non-web technical) administrators are familliar with.

Any suggestions are most welcome.

Again I apologise for the cross posting but this is a pressing matter, 
that requires I find a pointer to a solution, or an actual solution 
as fast as I can!

Kind regards:
Russ



#---#

  Believe nothing - consider everything   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


-- 
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] question about OCIBindByName(add some comment)

2001-05-22 Thread Thies C. Arntzen

On Tue, May 22, 2001 at 09:41:25AM +0900, Michael Cheung wrote:
 
 On Mon, 21 May 2001 16:39:05 +0200
 Thies C. Arntzen [EMAIL PROTECTED] wrote:
 
  On Mon, May 21, 2001 at 11:35:36PM +0900, Michael Cheung wrote:
   Hi;
 Linux 2.2.18 + oracle 8.1.7i + php-4.0.5 + oci8 interface.
 
 I use the following lines to get a result from database;
   But It give me result 0, it is incorrect;
   
   $sql=Select count(*) From member where email=:email;
   $sth=OCIParse($dbh,$sql);
   OCIBindByName($sth,email,$email,64);
   // with or without ':' is same, and use reference or not is also same here.
   OCIExecute($sth);
   OCIFetchInto($sth,$data);
  
  have you set $email in your script (before OCIExecute)?
 
 I have set the $email before OCIParse().
 
 Is there any problem about the varchar2 data type in bind operation?

it works for me - could you send me a _short_ but complete
testcase that reproduces your problem?

tc

-- 
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] Error MSG -410 while executing a select with ifx_query on a informix database on linux

2001-05-22 Thread Paul Gardiner

Hi Robert,

isql comes from (I)nformix (S)trutured (Q)uery (L)anguage. It's similar to
your sql-editor. I use the SE Database engine and not the Dynamic Server
like yourself. Whether this has anything to do with it I don't know but I
did run your code on my server just to make sure it ran properly and I
hadn't missed something. Obviously, changing the database connection and
select field and table.

Can you post the exact output of the page, not the html source?

Regards,
- Paul -

- Original Message -
From: Robert Hennig [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, May 22, 2001 3:40 PM
Subject: Re: [PHP-DB] Error MSG -410 while executing a select with ifx_query
on a informix database on linux


 Hi Paul,

 thanks for your fast reply. Maybe you could help me again :-) We are
working
 a lot with informix, so we thought to know every Programm, but isql is
 completely unknown. Is this a special programm?

 We have executed this select with a sql-editor on the server also as with
 dbaccess, on both it works.

 Thanks

 Robert

 Paul Gardiner [EMAIL PROTECTED] schrieb im Newsbeitrag
 001201c0e2ca$730d0c40$0200a8c0@PDG">news:001201c0e2ca$730d0c40$0200a8c0@PDG...
  Hi Robert,
 
  Your test code is correct although you could do with an
 ifx_close($conn_id);
  at the end.
 
  Have you tried running isql(assuming you've got it) and just trying to
run
  the query from there?
 
  Regards,
  - Paul -




 --
 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-DB] OCIFetch performance problem with more rows

2001-05-22 Thread snpe

Hello,
I have performance problem with OCIFetch (and OCIFetchInto, too) when query
return more rows.Same query from sqlplus is more fastest (more rows is worse
then less rows)

I assume that is array proccessing - is there array proccessing in php ?

Regards
Haris Peco
[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] PHP accessing MySQL

2001-05-22 Thread Jonathan Duncan

That is what I thought, so I set $db_num to another number and still came up
with the same error.

jkd


Darren [EMAIL PROTECTED] wrote in message
9e42lj$s7b$[EMAIL PROTECTED]">news:9e42lj$s7b$[EMAIL PROTECTED]...
 I think the 0 is referring to your $db_num
 Jonathan Duncan [EMAIL PROTECTED] wrote in message
 9e3suq$17r$[EMAIL PROTECTED]">news:9e3suq$17r$[EMAIL PROTECTED]...
  I am making a script to access MySQL and when I run it I get this:
 
  Warning: 0 is not a MySQL link index in
 /sites/htdocs/php/db_listtables.php
  on line 10
 
  Following is the first 10 lines of my script:
 
  ?
$connection = mysql_connect(localhost, user, password) or
  die(Couldn't connect.);
$dbs = mysql_list_dbs($connection) or die(Couldn't list databases.);
$db_list = UL;
$db_num = 0;
while ($db_num  mysql_num_rows($dbs)) {
  $db_names[$db_num] = mysql_tablename($dbs, $db_num);
   $db_list .= LI$db_names[$db_num];
   if (($db_names[$db_num] != mysql)  ($db_names[$db_num] !=
 tempdata))
  {
 $tables = mysql_list_dbs($db_names[$db_num]) or die(Couldn't list
  databases.);
 
  Any Ideas?  Thank you in advance!!
 
  Jonathan
 
 
 
  --
  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]




Fwd: Re: [PHP-DB] OCIFetch performance problem with more rows

2001-05-22 Thread snpe



--  Forwarded Message  --
Subject: Re: [PHP-DB] OCIFetch performance problem with more rows
Date: Tue, 22 May 2001 21:02:42 +0200
From: snpe [EMAIL PROTECTED]
To: Brian S. Dunworth [EMAIL PROTECTED]


On Tuesday 22 May 2001 20:59, you wrote:
 At 08:49 PM 5/22/01 +0200, snpe wrote:
 Hello,
  I have performance problem with OCIFetch (and OCIFetchInto, too)
  when query return more rows.Same query from sqlplus is more fastest (more
  rows is worse then less rows)

Are the columns you're fetching included in an Oracle index?  Without an
 appropriate index, your SQL statement is probably doing a full table scan,
 which can be *very* time-consuming...

Hello,
Indexes aren't  problem.I use php and sqlplus with same tables.
Sqlplus is faster.

regards

---

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

2001-05-22 Thread J.B.M. Case Schilder

every time i get this error:

Warning: MySQL Connection Failed: Unknown MySQL Server Host '0f2scom' (2) in
/web/sites/139/gamie/www.game-boy-advance.f2s.com/addartikel.php on line 22
Unable toconnect to database

this is de code(ther are dutch line's in it because this code is for an
dutch site):

?php

if ($action == 'add') {


if ($titel == '') {
echo centerfont face=verdana size=2span style=color:red;U heeft geen
titel ingevoerd! a href=javascipt:history.go
(-1)Terug!/a/span/font/center;
}

elseif ($inhoud == '') {
echo centerfont face=verdana size=2span style=color:red;U heeft geen
inhoud ingevoerd! a href=javascipt:history.go
(-1)Terug!/a/span/font/center;
}

else {
$DBhost = db.game-boy-advance.f2s.com;
$DBuser = *;
$DBpass = ***;
$DBName = ***;
$table = nieuws;

mysql_connect(db.game-boy-advance.f2s.com,*,**) or die(Unable
toconnect to database);
@mysql_select_db(db.game-boy-advance.f2s.com) or die(Unable to select
database gamie);

$sqlquery = SELECT max(id) FROM nieuws;
$result = mysql_query($sqlquery);
$number = mysql_numrows($result);
$art_id = ($number+1);

$sqlquery = INSERT INTO nieus VALUES ('', '$inhoud', '$titel');
$result = mysql_query($sqlquery);

echo centertable width=500 cellspacing=0 cellpadding=0trtd
align=centerfont face=verdana size=2
Uw artikel b $titel /b is succesvol toegevoegd aan onze database. Klik
a href=showartikel.php?art_id=$art_idhier/a
om hem te bekijken!/td/tr/table/center;

}
}

else {

echocenter
   form action='addartikel.php' method='POST'
   input type='hidden' name='action' value='add'
   table width='500' cellspacing='0' cellpadding='4' border=1
bordercolor='black'
   trtd bgcolor='black' colspan=2font face=verdana size=2
color=whiteVoeg een artikel toe (ook html toegestaan)/font/td/tr
   trtdfont face=verdana size=2bTitel/b/font/tdtdinput
type=text' name='titel' size=25/td/tr
   trtd valign=topfont face=verdana
size=2bInhoud/b/font/tdtdtextarea name='inhoud' cols=50
rows=10/textarea/td/tr
   trtd bgcolor='black' colspan=2input type=submit value='Voeg Artikel
toe!' input type=reset value='Herstel de waarden!'/td/tr
   /table/center;

}

?

what's wrong?




-- 
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] odbc with ms access

2001-05-22 Thread Rankin, Randy



http://www.microsoft.com/KB/Articles/Q128/8/08.HTM

-Original Message-
From: Dalyyla [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 22, 2001 7:32 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] odbc with ms access


hi,

Access to data with ms access via odbc is kinda slow . I would like to
know if it is normal and what can i do to make it faster

Thanks

Dalyyla


-- 
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] PHP accessing MySQL

2001-05-22 Thread Jonathan Duncan


Miles Thompson [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Jonathan .. see below.
 At 08:38 PM 5/18/01 +, Jonathan Duncan wrote:
 Miles
 
 Thank you for the response.  I did some debugging and the value of $dbs
is 2.
 
 I am not sure of what example you are referring to.  I am not using the
 manual currently, although I have the PDF version of it.

 http://www.php.net/mysql_list_dbs
 for on line version, with annotations!

I tried the example found on the site:

  while ($row = mysql_fetch_object($dbs)) {
echo $row-Database . \n;
  }

And the results were null.  It listed nothing.  I have a question about this
example, what is the - supposed to do?



 The incrementation of $db_num happens on line 24 but I only listed the
first
 10 lines because it seems to be a problem within the first 10 lines as
the
 error message indicates.
 
 If I change line 10 from:
 
 $tables = mysql_list_dbs($db_names[$db_num])
 
 to:
 
 $tables = mysql_list_dbs()
 
 the script runs and gives me a list of the databases redundantly:
 
 -mysql
 -test
 mysql
 test
 twignud
 -twignud
 mysql
 test
 twignud

 Cool! Although it's not what you want. g.
 But what is it telling us? We're just running through two loops, but
really
 asking for the same information each time, if I interpret it correctly.

 And if you look at your code, you have two nested loops, doing essentially
 the same thing - listing the databases.

That is pretty much what I am trying to do.  I want to list each database
and then the tables within those databases.


 ?
$connection = mysql_connect(localhost, user, password) or die
 (Couldn't connect.);
$dbs = mysql_list_dbs($connection) or die(Couldn't list databases.);
$db_list = UL;
$db_num = 0;
while ($db_num  mysql_num_rows($dbs)) {
  $db_names[$db_num] = mysql_tablename($dbs, $db_num);
  $db_list .= LI$db_names[$db_num];
  if (($db_names[$db_num] != mysql)  ($db_names[$db_num] !
 = tempdata)) {
  $tables = mysql_list_dbs($db_names[$db_num]) or die(Couldn't
list
 databases.);
$tables = mysql_list_dbs() or die(Couldn't list databases.);
$table_list = UL;
$table_num = 0;
while ($table_num  mysql_num_rows($tables)) {
  $table_names[$table_num] = mysql_tablename($tables,
$table_num);
  $table_list .= LI$table_names[$table_num];
  $table_num++;
}
$table_list .= /UL;
  }
  $db_list .= $table_list;
  $db_num++;
}
$db_list .= /UL;
 ?
 
 This is minus my debugging additions.  I tried to get info from
 $mysql_tablename but it came up blank every way I tried it.  It is as
though
 nothing is getting passed into $mysql_tablename.

 That's strange, because this annotation came from zak@php:
 [Editor's Note: mysql_db_name(), mysql_dbname() and mysql_tablename()
   are all aliases for mysql_result() and should behave in exactly the same
   fashion. [EMAIL PROTECTED]]

 Use mysql_db_name() instead of mysql_tablename() to read databases.
 http://php.net/manual/en/function.mysql-db-name.php

 So this should give us a list of keys and databases:
 while( $row = mysql_fetch_array( $dbs ) )
 {
  echo $row[ 0 ];
  echo $row[ 1 ];
 }


while($row = mysql_fetch_array($dbs)) {
echo Row 0 is , $row[0];
 echo Row 1 is , $row[1];
  }

Returns:

Row 0 is mysqlRow 1 is Row 0 is testRow 1 is Row 0 is twignudRow 1 is

-IE-

Row 0 is mysql
Row 1 is
Row 0 is test
Row 1 is
Row 0 is twignud
Row 1 is

 I'm wondering, if $row[ 0 ] returns the name of the database, and $row[
1 ]
 returns array. (Or vice versa.) If so, we should be able to nest another
 while () in there and fetch the table names. (If that's your intention.)

 I'll warn you that I get lost in multi-dimensional arrays very quickly,
and
 I'm freelancing this off the top of my head.

It seems that Row 1 doesn't have anything which may be the source of the
problem.  What do you think of this?


 Does this clarify anything in your mind?  I am taking this script
straight
 from a book.  However, the book is designed for PHP 4 and I am using PHP
 3.0.16, although I don't know if that would make a difference.

 Shouldn't, but is there any reason why you can't go to 4.0.5? Why not get
 the database names loop working first, and then go for the table names, a
 divide and conquer approach.

Sounds like a good plan, I will see what I can do.


 Thank you very much for your help,
 Jonathan

 My pleasure - you're digging on it too.
 Miles

Yep, I love this stuff!



-- 
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] PHP accessing MySQL

2001-05-22 Thread Julie Meloni

I believe you want to look at this page:
http://www.thickbook.com/books/phpfe_errata.phtml



-- 
++
| Julie Meloni ([EMAIL PROTECTED]) |
||
| PHP Essentials and PHP Fast  Easy |
|   http://www.thickbook.com |
++


-- 
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] PHP accessing MySQL

2001-05-22 Thread Jonathan Duncan

YES!!  I just had a feeling the book was wrong.  That did get rid of the
error.  However, it did not completely solve my issue.  Now when I run the
script I just get the message Couldn't list databases.  This just happens
to be the die message for the same line of code that I have been looking at:

   $tables = mysql_list_tables($db_names[$db_num]) or die(Couldn't list
databases.);

It is almost as if it is not being able to even list the tables from the
databases.  I am working right now on just listing the tables of a database
to see what happens.

Thank you,
jkd


Julie Meloni [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I believe you want to look at this page:
 http://www.thickbook.com/books/phpfe_errata.phtml



 --
 ++
 | Julie Meloni ([EMAIL PROTECTED]) |
 ||
 | PHP Essentials and PHP Fast  Easy |
 |   http://www.thickbook.com |
 ++


 --
 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-DB] Limiting # of connections to remote Oracle

2001-05-22 Thread Larry Osborn

Greetings all,
We are having serious issues with PHP4.0.5 using OCI8 and Apache 1.3.17.

We have 4 webservers that handle our various needs for oracle. Each server
has its MaxSpareServers in the httpd.conf set to 100. So that turns out to
be 400 connections to the Oracle database.  We are not using persistent
connections, because that makes the problem worse.  Does anyone know of a
way to limit the number of database connections without having to turn away
users by limiting the number of apache processes?

We are using php+apache+oci8 to subscribe and unsubscribe people to our
mailing list.  We have simple select and update queries using non-persistent
connections.  Im not too sure what other information I would need to
provide, Im just a webdeveloper, not a sysadmin, so please bear that in mind
:)

Thanks for any help you can give me.

Larry Osborn
Web Developer
Napster, Inc.



-- 
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] pulling images from a database

2001-05-22 Thread Gary Huntress

If you want to be efficient, store only the image metadata in the database
(path, filename, creator, date, dimentions, format, etc) in the database.
Keep the actual data as a file.


--
Regards,
Gary SuperID Huntress
===
FreeSQL.org offering free database hosting to developers
Visit http://www.freesql.org

Trent Reimer [EMAIL PROTECTED] wrote in message
9ebsd5$q0m$[EMAIL PROTECTED]">news:9ebsd5$q0m$[EMAIL PROTECTED]...
 I'm trying to find an efficient way to pull images from a database. What
I'm
 saying is that the actual image file itself is being stored as a Binary
 Large OBject in the database (MySQL) and that I want to use it on a web
 document.

 The only way I've been able to do it so far is to call an external script
 such as:

 img src=grab_image.php?image=picture1.jpg

 where grab_image.php goes and connects to the database and spits out the
 header information and then the binary data for the applicable picture.

 Is there a more efficient way to do this? Is there any way to embed the
 image information directly in the document without having to call an
 external script for each image?



 --
 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] php 4.0/win 2000/sql server

2001-05-22 Thread Nelson Reis

Hi,

I'm using PHP 4 and MySql Server under Windows 2000 and I don't have
any problem !

I'm actually using the Nusphere  integrated solution which includes PHP4,
MySql, Apache, Perl, ... .

Try this distribution !

You can find it at :
http://www.nusphere.com/cgi-bin/nsp.cgi/custsrvc/utils/download.htm?psn=

Hope it could help you !

Nelson

PHPFAN [EMAIL PROTECTED] a écrit dans le message news:
9eenk0$747$[EMAIL PROTECTED]
 When ever I am trying to access a php file with an error,my system is
 overwelmingly slowing down and restarting is the only solution.
 Previously I worked on linux/apache/php 4.0/mysql ,I never had such
 problem.I used to get some errors and I used to correct them but working
in
 this environment is almost impossible as I am restarting my system 95% of
 time.

 Any ideas what might be the problem and got any tips?

 Thanks in advance,
 Sagil.



 --
 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-DB] PLEASE HELP !!!

2001-05-22 Thread PHPFAN

I am running PHP 4.0.5 on Windows 2000 with SQL server databases.
If there is an error with my PHP code, my computer becomes very very slow
and  nothing works. The PHP process is using 99 % of the CPU. So I have to
restart the computer. This
happens everytime there is an error in my PHP code. For the work I am doing,
I have to use PHP with backend SQL
Server on Windows Platform.

Any suggestions will be greatly appreciated.

Thank you
PHPFAN



-- 
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] PLEASE HELP !!!

2001-05-22 Thread matthew knight

when you say an error - do you mean any error?
or specific errors? ie., you're not getting it stuck in an infinite loop?
(cpu time flips up to that when you stick in a loop)

or is it all errors?



PHPFAN [EMAIL PROTECTED] wrote in message
9eetk0$92d$[EMAIL PROTECTED]">news:9eetk0$92d$[EMAIL PROTECTED]...
 I am running PHP 4.0.5 on Windows 2000 with SQL server databases.
 If there is an error with my PHP code, my computer becomes very very slow
 and  nothing works. The PHP process is using 99 % of the CPU. So I have to
 restart the computer. This
 happens everytime there is an error in my PHP code. For the work I am
doing,
 I have to use PHP with backend SQL
 Server on Windows Platform.

 Any suggestions will be greatly appreciated.

 Thank you
 PHPFAN



 --
 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[2]: [PHP-DB] question about OCIBindByName(Resolved)

2001-05-22 Thread Michael Cheung

Thanks for all the reply.

I have resolve the problem by specified the bind type to 96(SLQT_AFC).
By explore the source, the default has been set to (SQLT_CHR).
as my data type is char(64), so I have to set it to 96, to get the correct
result.

modified source:
$sql=Select count(*) From member where email=:email;
$sth=OCIParse($dbh,$sql);
OCIBindByName($sth,email,$email,64,96);
// ^^ change here  
OCIExecute($sth);
OCIFetchInto($sth,$data);

Thanks.

Regards;
Michael


On Tue, 22 May 2001 17:39:03 +0200
Thies C. Arntzen [EMAIL PROTECTED] wrote:

 On Tue, May 22, 2001 at 09:41:25AM +0900, Michael Cheung wrote:
  
  On Mon, 21 May 2001 16:39:05 +0200
  Thies C. Arntzen [EMAIL PROTECTED] wrote:
  
   On Mon, May 21, 2001 at 11:35:36PM +0900, Michael Cheung wrote:
Hi;
Linux 2.2.18 + oracle 8.1.7i + php-4.0.5 + oci8 interface.

I use the following lines to get a result from database;
But It give me result 0, it is incorrect;

$sql=Select count(*) From member where email=:email;
$sth=OCIParse($dbh,$sql);
OCIBindByName($sth,email,$email,64);
// with or without ':' is same, and use reference or not is also same here.
OCIExecute($sth);
OCIFetchInto($sth,$data);
   
   have you set $email in your script (before OCIExecute)?
  
  I have set the $email before OCIParse().
  
  Is there any problem about the varchar2 data type in bind operation?
 
 it works for me - could you send me a _short_ but complete
 testcase that reproduces your problem?
 
 tc
 
 -- 
 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[2]: [PHP-DB] PLEASE HELP !!!

2001-05-22 Thread andRie Is

I bet, there is something logic error in your program..
PHP+apache is such a small program with low resources that cannot harm your
system ..


mk PHPFAN [EMAIL PROTECTED] wrote in message
mk 9eetk0$92d$[EMAIL PROTECTED]">news:9eetk0$92d$[EMAIL PROTECTED]...
 I am running PHP 4.0.5 on Windows 2000 with SQL server databases.
 If there is an error with my PHP code, my computer becomes very very slow
 and  nothing works. The PHP process is using 99 % of the CPU. So I have to
 restart the computer. This
 happens everytime there is an error in my PHP code. For the work I am
mk doing,
 I have to use PHP with backend SQL
 Server on Windows Platform.
-- 
Best regards,
 andRiemailto:[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-DB] Find - n - replace

2001-05-22 Thread John Starkey

Hello all.

I'm trying to set up a quick find and replace script. It's finding, and
it's pasting what I want, but on the following line, I can't get it to
replace. Can anyone help?

#!/usr/local/bin/php -q

?php

$fp = fopen( ./somefile.html,r+);
while ( !feof( $fp ) ) {
$line = fgets( $fp, 4096 );
if ( eregi( td, $line ) ) {
if ( eregi( 4[0-9]{2}, $line ) ) {
$liner = eregi_replace( 4[0-9]{2}, 470, $line );
fputs( $fp, $liner, strlen( $liner ) );
}
}
}

fclose( $fp );

?

Can anyone tell me how I can back the fput up one line so it overwrites
the result of the search?

Thanks,

John


-- 
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] Return Row count with OCI

2001-05-22 Thread Worawisut Pinyoyang

To all PHP-db guruz!
I'm novice on Oracle(OCI).In mysql has mysql_num_rows().
When i try to find OCI function about num rows i see OCIRowCount().
But in the manual told me that it cannot use with select statement.
How can i know the number of selected row?

Thanks in advance
-Worawisut


-- 
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] web to access/excel

2001-05-22 Thread Ken Wills


You can write excel files (ie files that excel associates with, if you have it) very 
easily
by just using a .csv extension, and the following type format:

field1, field2, field3

(ie print \field1\,\field2\,\field3\; )
Excel will display this as if it were a spreadsheet.

If you need to get more fancy than this, you could create something to write .dif files
(again, a text based format.)

Ken

* Jonathan Hilgeman [EMAIL PROTECTED] [010522 10:16]:
 Hi Russ,
 Try this package:
 http://phpclasses.upperdesign.com/browse.html/package/237
 
 You need to register for free to gain access, but this package is supposed
 to write Excel binary files. 
 
 Jonathan
 
 -Original Message-
 From: Russ Michell [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 22, 2001 5:01 AM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: [PHP-DB] web to access/excel
 
 
 *Apologies for cross-postings**
 
 Hi there all:
 
 Does anyone know of a product - preferably free, that once 
 installed, can take info from an ordinary HTML web based form and 
 drop it into an access/excel database/spreadsheet?? or a 
 pre-defined/written script or class written for Apache/php4/MySQL that 
 has the information filtering and sorting capabilites of excel/access??
 
 One of our departments urgently requires such functionality to increase 
 processing times of student enquiries. At present the information from 
 the students is in a non-standardised format in the form of an email 
 that has to be processed by hand.
 
 The data needs to be formalised from a structured online form, and 
 inserted into an access/excel type 'environment' that current 
 (non-web technical) administrators are familliar with.
 
 Any suggestions are most welcome.
 
 Again I apologise for the cross posting but this is a pressing matter, 
 that requires I find a pointer to a solution, or an actual solution 
 as fast as I can!
 
 Kind regards:
 Russ
 
 
 
 #---#
   
   Believe nothing - consider everything 
   
   Russ Michell
   Anglia Polytechnic University Webteam
   
   e: [EMAIL PROTECTED]
   w: www.apu.ac.uk/webteam
   t: +44 (0)1223 363271 x 2331
 
   www.theruss.com
   
 #---#
 
 
 -- 
 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]




Re: [PHP-DB] Find - n - replace

2001-05-22 Thread matthew knight

try looking at the fseek function, i think that does what you want:
http://uk.php.net/manual/en/function.fseek.php


John Starkey [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hello all.

 I'm trying to set up a quick find and replace script. It's finding, and
 it's pasting what I want, but on the following line, I can't get it to
 replace. Can anyone help?

 #!/usr/local/bin/php -q

 ?php

 $fp = fopen( ./somefile.html,r+);
 while ( !feof( $fp ) ) {
 $line = fgets( $fp, 4096 );
 if ( eregi( td, $line ) ) {
 if ( eregi( 4[0-9]{2}, $line ) ) {
 $liner = eregi_replace( 4[0-9]{2}, 470, $line );
 fputs( $fp, $liner, strlen( $liner ) );
 }
 }
 }

 fclose( $fp );

 ?

 Can anyone tell me how I can back the fput up one line so it overwrites
 the result of the search?

 Thanks,

 John


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