[PHP-DB] ORA-01460 error when useing bind sql on oracle from php

2003-11-20 Thread Are Pedersen
I get ORA-01460: unimplemented or unreasonable conversion requested 
when useing bind-sql on Oracle 9i.
I am useing OCI 8.1 client in PHP.

What is wrong? And what does this message mean?

Here is the code:
---***---
$bindarray1=array(':project1'=$project);
$bindarray1[':userid']=$userid;
$rs = sql_query($qs,$bindarray1);
function sql_query($qs,$bindargs) {
  $stmt = @OCIParse($this-db_sqlhandler, $qs);
  if (!$stmt) {
return false;
  }
  //bind all the variables
  if (is_array($bindargs)){
foreach ($bindargs as $bindname = $bindvalue){
  OCIBindByName($stmt,$bindname,$bindvalue,-1);
}
  }
  if (@OCIExecute($stmt)) {
return $stmt;
  }
  $DB_ERROR = OCIError($stmt);
  return $DB_ERROR;
}
---***---
vardump of bindargs:
array(2) {
  [:project1]=
  int(1)
  [:userid]=
  string(5) 10001
}
vardump of DB_ERROR:
array(4) {
  [code]=
  int(1460)
  [message]=
  string(62) ORA-01460: unimplemented or unreasonable conversion requested

  [offset]=
  int(0)
  [sqltext]=
  string(365) SELECT acl.prjid, acl.groupid, acl.read_access , 
acl.write_access,acl.delete_access,acl.change_access
FROM StructureTreeTbl outree, GroupChildrenTbl gg2, MembersTbl 
memb2, ACL acl
WHERE
(memb2.personid=:userid AND
memb2.groupid=gg2.gchildid AND
gg2.groupid=outree.orgchild AND
outree.orgid = acl.groupid  AND acl.prjid=:project1)

}

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


[PHP-DB] Re: ORA-01460 error when useing bind sql on oracle from php

2003-11-20 Thread Are Pedersen
Sorry about replying to my own posts, but...
Problem solved!
As OCIBindByName is binding to the actual variable, that variable must 
not be changed.

I modified my script to look like this:
---***---
$ci=0;
foreach ($bindargs as $bindname = $bindvalue){
  ${bindval$ci}=$bindvalue;
  OCIBindByName($stmt,$bindname,${bindval$ci},-1);
  $ci++;
}
---***---
Are Pedersen wrote:
I get ORA-01460: unimplemented or unreasonable conversion requested 
when useing bind-sql on Oracle 9i.
I am useing OCI 8.1 client in PHP.

What is wrong? And what does this message mean?

Here is the code:
---***---
$bindarray1=array(':project1'=$project);
$bindarray1[':userid']=$userid;
$rs = sql_query($qs,$bindarray1);
function sql_query($qs,$bindargs) {
  $stmt = @OCIParse($this-db_sqlhandler, $qs);
  if (!$stmt) {
return false;
  }
  //bind all the variables
  if (is_array($bindargs)){
foreach ($bindargs as $bindname = $bindvalue){
  OCIBindByName($stmt,$bindname,$bindvalue,-1);
}
  }
  if (@OCIExecute($stmt)) {
return $stmt;
  }
  $DB_ERROR = OCIError($stmt);
  return $DB_ERROR;
}
---***---
vardump of bindargs:
array(2) {
  [:project1]=
  int(1)
  [:userid]=
  string(5) 10001
}
vardump of DB_ERROR:
array(4) {
  [code]=
  int(1460)
  [message]=
  string(62) ORA-01460: unimplemented or unreasonable conversion requested

  [offset]=
  int(0)
  [sqltext]=
  string(365) SELECT acl.prjid, acl.groupid, acl.read_access , 
acl.write_access,acl.delete_access,acl.change_access
FROM StructureTreeTbl outree, GroupChildrenTbl gg2, 
MembersTbl memb2, ACL acl
WHERE
(memb2.personid=:userid AND
memb2.groupid=gg2.gchildid AND
gg2.groupid=outree.orgchild AND
outree.orgid = acl.groupid  AND acl.prjid=:project1)

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


[PHP-DB] Parse error on array and SQL query

2003-11-20 Thread Dillon, John

On line 188 and similar:
line 187$this=$altIDs[$i]; 
line 188$query .= ID='$this'; 

I get the error: Parse error: parse error in
/home/jdillon/public_html/provreport.php on line 188

Could this be because some setting has been changed on my shared host?

John

































   http://www.cantor.com
CONFIDENTIAL: This e-mail, including its contents and attachments, if any, are 
confidential. If you are not the named recipient please notify the sender and 
immediately delete it. You may not disseminate, distribute, or forward this e-mail 
message or disclose its contents to anybody else. Copyright and any other intellectual 
property rights in its contents are the sole property of Cantor Fitzgerald.
 E-mail transmission cannot be guaranteed to be secure or error-free. The sender 
therefore does not accept liability for any errors or omissions in the contents of 
this message which arise as a result of e-mail transmission.  If verification is 
required please request a hard-copy version.
 Although we routinely screen for viruses, addressees should check this e-mail and 
any attachments for viruses. We make no representation or warranty as to the absence 
of viruses in this e-mail or any attachments. Please note that to ensure regulatory 
compliance and for the protection of our customers and business, we may monitor and 
read e-mails sent to and from our server(s). 

For further important information, please read the  Important Legal Information and 
Legal Statement at http://www.cantor.com/legal_information.html

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



[PHP-DB] nested sets?

2003-11-20 Thread ma
hi everybody!

i try to make a clickable menu. it should be outputed as XML. i found a
solution to make it possible to decend only the selected menues. but is
there a easier solution?
my goal is to first show only the first (level=0) level. if the user clicks
on the menu it should select the second (level=1) level, but only from the
menu he clicked. (so HAVING level=1 doesn't help :( )
does anybody know a solution or a good reference for nested sets?
(don't have the possibility to use pear - unfortunately cause there are some
great tools)

here's my db-structure:

id (int) unsigned auto_increment
left (int) unsigned
right (int) unsigned
level (int) unsigned (default: 0)
title (varchar)
link (varchar)
menu (int) unsigned (default: 0)

heres my solution (using singleton registry pattern and a sql-class working
with adodb-functions):

###

$reg = registry::instance();
$sql = $reg::getEntry('sql');

# $_GET['menu'] = 'About/Company/History' // - something like this

$qry ='SELECT
`first`.`left`,
`first`.`id`,
`first`.`link`,
`first`.`title`,
`first`.`level`,
ROUND((`first`.`right`-`first`.`left`-1)/2) AS `children`
FROM
`'.$grz-cnf['tablePluginPrefix'].'menu` AS `first`,
`'.$grz-cnf['tablePluginPrefix'].'menu` AS `second`
';
$open = array();
if(isset($_GET['menu'])) {
$open = explode(';', $_GET['menu']);
$or = join(' OR `third`.`id`=', $open);
$qry .=',`'.$grz-cnf['tablePluginPrefix'].'menu` AS `third`
WHERE
(`first`.`left` BETWEEN `second`.`left` AND
`second`.`right`
AND `first`.`left` BETWEEN `third`.`left` AND
`third`.`right`
AND `first`.`level`=`third`.`level`+1
AND (`third`.`id`='.$or.'))
OR
(`first`.`left` BETWEEN `second`.`left` AND
`second`.`right`
AND `first`.`level`=0)
';
} else {
$qry .='WHERE
`first`.`left` BETWEEN `second`.`left` AND
`second`.`right`
AND `first`.`level`=0
';
}
$qry .='AND `first`.`menu`='.$menuID.'
GROUP BY
`first`.`left`
ORDER BY
`first`.`left`
';

$res = $sql-query($qry);

###

thx a lot for taking your time,
help would be warmly appretiated...

-ma

# life would be easier if i knew the source code...

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



[PHP-DB] Linux/PHP with M$/SQL Server

2003-11-20 Thread Matt Giddings
Has anybody been able to bridge a Linux/php setup to a M$/SQL Server 
database?  Is this possible using JDBC or a Unix ODBC connection to the 
SQL Server?  Any pointers in the right direction would be greatly 
appreciated.

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


RE: [PHP-DB] Parse error on array and SQL query

2003-11-20 Thread Hutchins, Richard
Speaking for myself only, I'm probably going to need to see more code than
this to be able to help. These two lines appear to be OK. The error might be
in what feeds line 187.

 -Original Message-
 From: Dillon, John [mailto:[EMAIL PROTECTED]
 Sent: Thursday, November 20, 2003 9:16 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Parse error on array and SQL query
 
 
 
 On line 188 and similar:
   line 187$this=$altIDs[$i]; 
   line 188$query .= ID='$this'; 
 
 I get the error: Parse error: parse error in
 /home/jdillon/public_html/provreport.php on line 188
 
 Could this be because some setting has been changed on my shared host?
 
 John
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
    http://www.cantor.com
 CONFIDENTIAL: This e-mail, including its contents and 
 attachments, if any, are confidential. If you are not the 
 named recipient please notify the sender and immediately 
 delete it. You may not disseminate, distribute, or forward 
 this e-mail message or disclose its contents to anybody else. 
 Copyright and any other intellectual property rights in its 
 contents are the sole property of Cantor Fitzgerald.
  E-mail transmission cannot be guaranteed to be secure or 
 error-free. The sender therefore does not accept liability 
 for any errors or omissions in the contents of this message 
 which arise as a result of e-mail transmission.  If 
 verification is required please request a hard-copy version.
  Although we routinely screen for viruses, addressees 
 should check this e-mail and any attachments for viruses. We 
 make no representation or warranty as to the absence of 
 viruses in this e-mail or any attachments. Please note that 
 to ensure regulatory compliance and for the protection of our 
 customers and business, we may monitor and read e-mails sent 
 to and from our server(s). 
 
 For further important information, please read the  Important 
 Legal Information and Legal Statement at 
 http://www.cantor.com/legal_information.html
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



Re: [PHP-DB] Linux/PHP with M$/SQL Server

2003-11-20 Thread jeffrey_n_Dyke

you can use freetds (http://freetds.org) i think there is even an rpm...
Then you just use the mssql_* functions built into php

hth
Jeff


   
 
  Matt Giddings
 
  [EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  clink.net   cc: 
 
   Subject:  [PHP-DB] Linux/PHP with 
M$/SQL Server  
  11/20/2003 09:40 
 
  AM   
 
   
 
   
 




Has anybody been able to bridge a Linux/php setup to a M$/SQL Server
database?  Is this possible using JDBC or a Unix ODBC connection to the
SQL Server?  Any pointers in the right direction would be greatly
appreciated.

Thanks,
Matt

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

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



[PHP-DB] Re: Linux/PHP with M$/SQL Server

2003-11-20 Thread pete M
I use PEAR db which is included wit the php distribution

http://pear.php.net/manual/en/package.database.php
http://vulcanonet.com/soft/?pack=pear_tut
pete

Matt Giddings wrote:

Has anybody been able to bridge a Linux/php setup to a M$/SQL Server 
database?  Is this possible using JDBC or a Unix ODBC connection to the 
SQL Server?  Any pointers in the right direction would be greatly 
appreciated.

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


Re: [PHP-DB] Linux/PHP with M$/SQL Server

2003-11-20 Thread Matt Giddings
Thanks Jeff,  I'll look into FreeTDS.

Matt

[EMAIL PROTECTED] wrote:

you can use freetds (http://freetds.org) i think there is even an rpm...
Then you just use the mssql_* functions built into php
hth
Jeff
   
 Matt Giddings 
 [EMAIL PROTECTED]To:   [EMAIL PROTECTED]   
 clink.net   cc:  
  Subject:  [PHP-DB] Linux/PHP with M$/SQL Server  
 11/20/2003 09:40  
 AM
   
   



Has anybody been able to bridge a Linux/php setup to a M$/SQL Server
database?  Is this possible using JDBC or a Unix ODBC connection to the
SQL Server?  Any pointers in the right direction would be greatly
appreciated.
Thanks,
Matt
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 

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


Re: [PHP-DB] Linux/PHP with M$/SQL Server

2003-11-20 Thread Frank M. Kromann
Hi,

It is also described in the documentation at http://php.net/mssql.

- Frank


 Thanks Jeff,  I'll look into FreeTDS.
 
 Matt
 
 [EMAIL PROTECTED] wrote:
 
 you can use freetds (http://freetds.org) i think there is even an
rpm...
 Then you just use the mssql_* functions built into php
 
 hth
 Jeff
 
 


   Matt Giddings

   [EMAIL PROTECTED]To:  
[EMAIL PROTECTED]  

   clink.net   cc: 

Subject:  [PHP-DB]
Linux/PHP with M$/SQL Server  
   11/20/2003 09:40 

   AM   





 
 
 
 
 Has anybody been able to bridge a Linux/php setup to a M$/SQL Server
 database?  Is this possible using JDBC or a Unix ODBC connection to
the
 SQL Server?  Any pointers in the right direction would be greatly
 appreciated.
 
 Thanks,
 Matt
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
   
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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



Re: [PHP-DB] Linux/PHP with M$/SQL Server

2003-11-20 Thread Matt Giddings
Doh!  RTFM.  : )  You caught me..

Matt

Frank M. Kromann wrote:

Hi,

It is also described in the documentation at http://php.net/mssql.

- Frank

 

Thanks Jeff,  I'll look into FreeTDS.

Matt

[EMAIL PROTECTED] wrote:

   

you can use freetds (http://freetds.org) i think there is even an
 

rpm...
 

Then you just use the mssql_* functions built into php

hth
Jeff
 
 

   
 

Matt Giddings
 

   
 

[EMAIL PROTECTED]To:  
 

[EMAIL PROTECTED]  
   
 

clink.net   cc: 
 

   
 

 Subject:  [PHP-DB]
 

Linux/PHP with M$/SQL Server  
 

11/20/2003 09:40 
 

   
 

AM   
 

   
 

 
 

   
 

 
 

   
 



Has anybody been able to bridge a Linux/php setup to a M$/SQL Server
database?  Is this possible using JDBC or a Unix ODBC connection to
 

the
 

SQL Server?  Any pointers in the right direction would be greatly
appreciated.
Thanks,
Matt
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


 

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

 

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


RE: [PHP-DB] Parse error on array and SQL query

2003-11-20 Thread Dillon, John
My host provider suggested escaping the SQL: $query .= ID=\'$this\'; which
gets rid of the php error but gives invalid SQL.  After a few exchanges with
them it suddenly worked again as: $query .= ID='$this';.

-Original Message-
From: Hutchins, Richard [mailto:[EMAIL PROTECTED]
Sent: 20 November 2003 14:43
To: 'Dillon, John'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Parse error on array and SQL query


Speaking for myself only, I'm probably going to need to see more code than
this to be able to help. These two lines appear to be OK. The error might be
in what feeds line 187.

 -Original Message-
 From: Dillon, John [mailto:[EMAIL PROTECTED]
 Sent: Thursday, November 20, 2003 9:16 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Parse error on array and SQL query
 
 
 
 On line 188 and similar:
   line 187$this=$altIDs[$i]; 
   line 188$query .= ID='$this'; 
 
 I get the error: Parse error: parse error in
 /home/jdillon/public_html/provreport.php on line 188
 
 Could this be because some setting has been changed on my shared host?
 
 John
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
    http://www.cantor.com
 CONFIDENTIAL: This e-mail, including its contents and 
 attachments, if any, are confidential. If you are not the 
 named recipient please notify the sender and immediately 
 delete it. You may not disseminate, distribute, or forward 
 this e-mail message or disclose its contents to anybody else. 
 Copyright and any other intellectual property rights in its 
 contents are the sole property of Cantor Fitzgerald.
  E-mail transmission cannot be guaranteed to be secure or 
 error-free. The sender therefore does not accept liability 
 for any errors or omissions in the contents of this message 
 which arise as a result of e-mail transmission.  If 
 verification is required please request a hard-copy version.
  Although we routinely screen for viruses, addressees 
 should check this e-mail and any attachments for viruses. We 
 make no representation or warranty as to the absence of 
 viruses in this e-mail or any attachments. Please note that 
 to ensure regulatory compliance and for the protection of our 
 customers and business, we may monitor and read e-mails sent 
 to and from our server(s). 
 
 For further important information, please read the  Important 
 Legal Information and Legal Statement at 
 http://www.cantor.com/legal_information.html
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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

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



[PHP-DB] how obtain last id past insert?

2003-11-20 Thread Webmaster D.G.R.E.R.
Hi:
How i obtain inmediatly the id of last insert ?
For example i have a forum, when the user post a question, i send a mail
to administrator, but i want to refer the id from this insert, how i do this
?
Well i think to make a select max(id) inmediatly but i beliebe that must
have any colision from other user that post other question.
Thank you.

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



Re: [PHP-DB] how obtain last id past insert?

2003-11-20 Thread jeffrey_n_Dyke

if you're using mysql
  php.net/mysql_insert_id

if you're not, there may be a variant for you db

hth
Jeff


   
 
  Webmaster   
 
  D.G.R.E.R.  To:   [EMAIL PROTECTED]   
  
  [EMAIL PROTECTED]cc:
  
  ios.gov.ar  Subject:  [PHP-DB] how obtain last 
id past insert?   
   
 
  11/20/2003 02:52 PM  
 
   
 
   
 




Hi:
How i obtain inmediatly the id of last insert ?
For example i have a forum, when the user post a question, i send a
mail
to administrator, but i want to refer the id from this insert, how i do
this
?
Well i think to make a select max(id) inmediatly but i beliebe that
must
have any colision from other user that post other question.
Thank you.

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

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



[PHP-DB] Re: Subject: Hitcounter works on production server but not on localhost

2003-11-20 Thread Neil Smth
Its not a permissions thing. You need to ensure that you provide PHP with a 
full path to the hit counter file :

countrerlog.txt is a relative path.
c:\\Inetpub\\wwwroot\\WCBE\\countrterlog.txt is a full path.
You need to do the same with the relative path to 
FX_DataCounter/wcbecounter.txt as well

Cheers - Neil.

At 13:25 20/11/2003 +, you wrote:
From: Paul Ihrig [EMAIL PROTECTED]
Date: Wed, 19 Nov 2003 07:16:11 -0500
Subject: works on production server but not on localhost
hey guys..
just getting back in to using a little php.
have 2 simple hit counters that work fine on the production server.
but on my localhost it throughs several errors. looks like a permissions
thing?
i am not sure if there is a setting in my php.ini file that needs to be
tweaked.
kind of blind to the errors.
looks like a permissions thing?

hit counter: Warning: fopen(counterlog.txt, w) - Permission denied in
C:\Inetpub\wwwroot\WCBE\counter.php on line 4 Warning: fwrite(): supplied
argument is not a valid File-Handle resource in
C:\Inetpub\wwwroot\WCBE\counter.php on line 5 Warning: fclose(): supplied
argument is not a valid File-Handle resource in
C:\Inetpub\wwwroot\WCBE\counter.php on line 6 12
hit counter2: 1
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Parse error on array and SQL query

2003-11-20 Thread John W. Holmes
Dillon, John wrote:

On line 188 and similar:
	line 187		$this=$altIDs[$i]; 
	line 188		$query .= ID='$this'; 

I get the error: Parse error: parse error in
/home/jdillon/public_html/provreport.php on line 188
Could this be because some setting has been changed on my shared host?
$this is normally used in object oriented programming to signify the 
current object. That may be causing the trouble. I'd use another 
variable than $this.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

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


Re: [PHP-DB] how obtain last id past insert?

2003-11-20 Thread John W. Holmes
Webmaster D.G.R.E.R. wrote:

Hi:
How i obtain inmediatly the id of last insert ?
For example i have a forum, when the user post a question, i send a mail
to administrator, but i want to refer the id from this insert, how i do this
?
Well i think to make a select max(id) inmediatly but i beliebe that must
have any colision from other user that post other question.
What database are you using? You may be able to use mysql_insert_id() or 
 SELECT @@IDENTITY depending upon your DB...

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

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


[PHP-DB] RE: Subject: Hitcounter works on production server but not on localhost

2003-11-20 Thread Paul Ihrig
hey niel.
thanks man...
thats wierd, why does it need to be full?

how would i have been able to figure that out?
appreciate it..

-Original Message-
From: Neil Smth [mailto:[EMAIL PROTECTED]
Sent: Thursday, November 20, 2003 12:53 PM
To:
Cc: [EMAIL PROTECTED]
Subject: Re: Subject: Hitcounter works on production server but not on
localhost


Its not a permissions thing. You need to ensure that you provide PHP with a
full path to the hit counter file :

countrerlog.txt is a relative path.
c:\\Inetpub\\wwwroot\\WCBE\\countrterlog.txt is a full path.

You need to do the same with the relative path to
FX_DataCounter/wcbecounter.txt as well

Cheers - Neil.

At 13:25 20/11/2003 +, you wrote:
From: Paul Ihrig [EMAIL PROTECTED]
Date: Wed, 19 Nov 2003 07:16:11 -0500
Subject: works on production server but not on localhost

hey guys..
just getting back in to using a little php.

have 2 simple hit counters that work fine on the production server.
but on my localhost it throughs several errors. looks like a permissions
thing?

i am not sure if there is a setting in my php.ini file that needs to be
tweaked.
kind of blind to the errors.

looks like a permissions thing?

hit counter: Warning: fopen(counterlog.txt, w) - Permission denied in
C:\Inetpub\wwwroot\WCBE\counter.php on line 4 Warning: fwrite(): supplied
argument is not a valid File-Handle resource in
C:\Inetpub\wwwroot\WCBE\counter.php on line 5 Warning: fclose(): supplied
argument is not a valid File-Handle resource in
C:\Inetpub\wwwroot\WCBE\counter.php on line 6 12
hit counter2: 1

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



Re: Re: [PHP-DB] Read file

2003-11-20 Thread Neil Smth
OK Error in my last post, the mail reader munged the HTML so if you need as 
source use the XML data below and hopefully the text below will appear 
as html code ;-)

Cheers - Neil

lt;htmlgt;
lt;headgt;
lt;titlegt;Demo Hotel Loaderlt;/titlegt;
lt;/headgt;
lt;body onload=populatelist()gt;
lt;script language=javascript1.2gt;
lt;!--
oxmlDocument = new ActiveXObject(MSXML2.DOMDocument);
oxmlDocument.load(hotels.xml);
function populatelist() {
var hotels=oxmlDocument.selectNodes(/hotels/hotel);
if (hotels != null) {
d=document.forms[hotelupdate].list;
d.length=0;
d[0]=new Option('--Please Select--','',true);
for (i=0;ihotels.length;i++) {
d.length++;
d[i+1]=new Option();
d[i+1].value=hotels[i].selectSingleNode(id).text;
d[i+1].text=hotels[i].selectSingleNode(name).text;
}
}
}
function populatevalues() {
d=document.forms[hotelupdate];
// Get hotel ID #
v=d.list[d.list.selectedIndex].value;
// Use this to read the hotel/phone node having this hotel ID
field=oxmlDocument.selectSingleNode(/hotels/hotel[id='+v+']/phone);
// Set form's phone field to the text of this node
d.phone.value=field.text;
// Now to read the hotel/address node having this hotel ID
field=oxmlDocument.selectSingleNode(/hotels/hotel[id='+v+']/address);
// Set form's address field to the text of this node
d.address.value=field.text;
}
//--gt;
lt;/scriptgt;
lt;form name=hotelupdate id=hotelupdate action=post 
method=http://www.my-server.com/myurl.php; onsubmit=alert('This would 
send these values to your website');return false;gt;
lt;select name=list id=list 
onchange=populatevalues()gt;lt;/selectgt; Phone :
lt;input type=text name=phone id=phone size=15 maxlength=24 /gt;
lt;br /gt;
lt;textarea name=address id=address rows=3 cols=40 
wrap=virtualgt;lt;/textareagt;
lt;br /gt;
lt;input type=submit name=submit id=submit value=Send ! /gt;
lt;/formgt;

lt;/bodygt;
lt;/htmlgt;
At 13:25 20/11/2003 +, you wrote:
Date: Wed, 19 Nov 2003 20:02:43 +
To: [EMAIL PROTECTED]
From: Neil Smth [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
Subject: Re: [PHP-DB] Read file
It's usually easier to show with an example : This took about 30 minutes 
to write :

Here's an XML file - copy and paste, and save as hotels.xml :
?xml version=1.0?
hotels
hotel
id1/id
nameBangkok oriental/name
address50 High Street, Kowloon/address
phone+12 451 708 3282/phone
/hotel
hotel
id2/id
nameHilton Marriott/name
address2042 Michael Wood Street/address
phone+44 238 9125467/phone
/hotel
hotel
id3/id
nameSwallow Royal/name
address91-97 Royal Fort Crescent/address
phone+01 1209 432 2345/phone
/hotel
/hotels
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] Parse error on array and SQL query

2003-11-20 Thread Dillon, John

Dillon, John wrote:

 On line 188 and similar:
   line 187$this=$altIDs[$i]; 
   line 188$query .= ID='$this'; 
 
 I get the error: Parse error: parse error in
 /home/jdillon/public_html/provreport.php on line 188
 
 Could this be because some setting has been changed on my shared host?

$this is normally used in object oriented programming to signify the 
current object. That may be causing the trouble. I'd use another 
variable than $this.

-- 
---John Holmes...


Tried that, doesn't work with:

$query=INSERT INTO ReplyTbl VALUES (' . $monster1 . ', ' . $monster2 .
', ' . $monster3 . ', NULL, NULL);

Don't suppose they use 'monster' as a reserved word...

but the similar code works in another file.

John


http://www.cantor.com
CONFIDENTIAL: This e-mail, including its contents and attachments, if any, are 
confidential. If you are not the named recipient please notify the sender and 
immediately delete it. You may not disseminate, distribute, or forward this e-mail 
message or disclose its contents to anybody else. Copyright and any other intellectual 
property rights in its contents are the sole property of Cantor Fitzgerald.
 E-mail transmission cannot be guaranteed to be secure or error-free. The sender 
therefore does not accept liability for any errors or omissions in the contents of 
this message which arise as a result of e-mail transmission.  If verification is 
required please request a hard-copy version.
 Although we routinely screen for viruses, addressees should check this e-mail and 
any attachments for viruses. We make no representation or warranty as to the absence 
of viruses in this e-mail or any attachments. Please note that to ensure regulatory 
compliance and for the protection of our customers and business, we may monitor and 
read e-mails sent to and from our server(s). 

For further important information, please read the  Important Legal Information and 
Legal Statement at http://www.cantor.com/legal_information.html

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



Re: [PHP-DB] Parse error on array and SQL query

2003-11-20 Thread John W. Holmes
Dillon, John wrote:

 Tried that, doesn't work with:

 $query=INSERT INTO ReplyTbl VALUES (' . $monster1 . ', ' .
 $monster2 .
 ', ' . $monster3 . ', NULL, NULL);

 Don't suppose they use 'monster' as a reserved word...
How does it not work again??

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

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


Re: [PHP-DB] how obtain last id past insert?

2003-11-20 Thread pete M
depends which DB your using
in mysql its
select last_insert_id()
and in mssql for example its
select @identity
have fun

Pete

Webmaster D.G.R.E.R. wrote:

Hi:
How i obtain inmediatly the id of last insert ?
For example i have a forum, when the user post a question, i send a mail
to administrator, but i want to refer the id from this insert, how i do this
?
Well i think to make a select max(id) inmediatly but i beliebe that must
have any colision from other user that post other question.
Thank you.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] Parse error on array and SQL query

2003-11-20 Thread Hutchins, Richard
If you're not getting the parse error anymore, I'd suggest you echo $query
to the browser and check to see that the SQL statement is what you expect it
to be. Can't count the number of times doing that has pointed out some stray
apostrophe or comma or something that killed the query.

 -Original Message-
 From: John W. Holmes [mailto:[EMAIL PROTECTED]
 Sent: Thursday, November 20, 2003 1:09 PM
 To: Dillon, John
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Parse error on array and SQL query
 
 
 Dillon, John wrote:
 
   Tried that, doesn't work with:
  
   $query=INSERT INTO ReplyTbl VALUES (' . $monster1 . ', ' .
   $monster2 .
   ', ' . $monster3 . ', NULL, NULL);
  
   Don't suppose they use 'monster' as a reserved word...
 
 How does it not work again??
 
 -- 
 ---John Holmes...
 
 Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
 
 php|architect: The Magazine for PHP Professionals – www.phparch.com
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



[PHP-DB] Can't connect to local MySQL

2003-11-20 Thread Jose
 $link = mysql_pconnect(localhost, bm_user, password) or die(Could
not connect :  . mysql_error());

Return :
Could not connect : Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock' (13)

If I run
shellmysql -h localhost -u bm_user -ppassword
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 29 to server version: 4.0.16-standard

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.


What is the problem?

Thank you
Jose.

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



[PHP-DB] MySQL and PHP

2003-11-20 Thread Jose
I'm trying to work with MySQL 4.0.16-standard and PHP php-4.3.4
I'm getting the folowing error:
Fatal error: Call to undefined function: mysql_pconnect() in
/var/www/html/db_fns.php on line 5

Any Ideas what I am missing in the configuration.

If I run phpinfo() I get:

  System Linux stripples.devel.redhat.com 2.4.21-1.1931.2.274.entsmp #1
SMP Tue Jun 24 11:18:10 EDT 2003 i686 i686 i386 GNU/Linux
  Build Date Jun 29 2003 16:34:10
  Configure Command './configure' '--host=i386-redhat-linux'
'--build=i386-redhat-linux' '--target=i386-redhat-linux-gnu'
'--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin'
'--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share'
'--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec'
'--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man'
'--infodir=/usr/share/info' '--cache-file=../config.cache'
'--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d'
'--enable-force-cgi-redirect' '--disable-debug' '--enable-pic'
'--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-db3'
'--with-curl' '--with-dom=/usr' '--with-exec-dir=/usr/bin'
'--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd'
'--enable-gd-native-ttf' '--with-ttf' '--with-gdbm' '--with-gettext'
'--with-ncurses' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr'
'--with-openssl' '--with-png' '--with-pspell' '--with-regex=system'
'--with-xml' '--with-expat-dir=/usr' '--with-zlib' '--with-layout=GNU'
'--enable-bcmath' '--enable-exif' '--enable-ftp' '--enable-magic-quotes'
'--enable-safe-mode' '--enable-sockets' '--enable-sysvsem'
'--enable-sysvshm' '--enable-discard-path' '--enable-track-vars'
'--enable-trans-sid' '--enable-yp' '--enable-wddx' '--without-oci8'
'--with-pear=/usr/share/pear' '--with-imap=shared' '--with-imap-ssl'
'--with-kerberos=/usr/kerberos' '--with-ldap=shared'
'--with-mysql=shared,/usr' '--with-pgsql=shared' '--with-snmp=shared,/usr'
'--with-snmp=shared' '--enable-ucd-snmp-hack' '--with-unixODBC=shared'
'--enable-memory-limit' '--enable-bcmath' '--enable-shmop'
'--enable-versioning' '--enable-calendar' '--enable-dbx' '--enable-dio'
'--enable-mcal' '--with-apxs2=/usr/sbin/apxs'
  Server API Apache 2.0 Filter
  Virtual Directory Support disabled
  Configuration File (php.ini) Path /etc/php.ini
  Scan this dir for additional .ini files /etc/php.d
  additional .ini files parsed
  Debug Build no
  Thread Safety disabled

   This program makes use of the Zend Scripting Language Engine:
  Zend Engine v1.2.0, Copyright (c) 1998-2002 Zend Technologies






  Directive Local Value Master Value
  allow_call_time_pass_reference
 On On
  allow_url_fopen
 1 1
  always_populate_raw_post_data
 0 0
  arg_separator.input
  
  arg_separator.output
  
  asp_tags
 Off Off
  auto_append_file
 no value no value
  auto_prepend_file
 no value no value
  browscap
 no value no value
  default_charset
 no value no value
  default_mimetype
 text/html text/html
  define_syslog_variables
 Off Off
  disable_functions
 no value no value
  display_errors
 On On
  display_startup_errors
 Off Off
  doc_root
 no value no value
  enable_dl
 On On
  error_append_string
 no value no value
  error_log
 no value no value
  error_prepend_string
 no value no value
  error_reporting
 2039 2039
  expose_php
 On On
  extension_dir
 /usr/lib/php4 /usr/lib/php4
  file_uploads
 1 1
  gpc_order
 GPC GPC
  highlight.bg
 #FF #FF
  highlight.comment
 #FF9900 #FF9900
  highlight.default
 #CC #CC
  highlight.html
 #00 #00
  highlight.keyword
 #006600 #006600
  highlight.string
 #CC #CC
  html_errors
 On On
  ignore_user_abort
 Off Off
  implicit_flush
 Off Off
  include_path
 .:/usr/share/pear .:/usr/share/pear
  log_errors
 Off Off
  magic_quotes_gpc
 On On
  magic_quotes_runtime
 Off Off
  magic_quotes_sybase
 Off Off
  max_execution_time
 30 30
  memory_limit
 8M 8M
  open_basedir
 no value no value
  output_buffering
 no value no value
  output_handler
 no value no value
  post_max_size
 8M 8M
  precision
 14 14
  register_argc_argv
 On On
  register_globals
 Off Off
  safe_mode
 Off Off
  safe_mode_exec_dir
 no value no value
  safe_mode_gid
 Off Off
  safe_mode_include_dir
 no value no value
  sendmail_from
 [EMAIL PROTECTED] [EMAIL PROTECTED]
  sendmail_path
 /usr/sbin/sendmail -t -i /usr/sbin/sendmail -t -i
  short_open_tag
 On On
  SMTP
 

[PHP-DB] Unsure of how to perform query and results..

2003-11-20 Thread Aaron Wolski
Hi Guys,
 
I have data in a Db that looks something like:
 
14,[EMAIL PROTECTED],Andrew,Smith
1,[EMAIL PROTECTED],Andrew,Smith
14,[EMAIL PROTECTED],Barbara,Richardson
1,[EMAIL PROTECTED],Barbara,Richardson
 
The number represents a product_id that was purchased by the customer in
question. As you can see from this example.. I have a two customers who
purchased two different products.
 
What I NEED to do is have one entry for each customer but with both
their product_id in the same result. For example:
 
14,1,[EMAIL PROTECTED],Andrew,Smith
 
ANY clue how I could go about getting this to work? I'm very desperate
and running out of time :-(
 
Thanks so much!
 
Aaron
 
 


[PHP-DB] MySQL and PHP

2003-11-20 Thread Jose
I'm trying to connect to a MySQL database. I'm able to do it from mysql, I
can see my databases and tables.
When I try to see it from php I get the error:

Fatal error: Call to undefined function: mysql_connect() in
/var/www/html/test2.php on line 3

What I'm missing in the configuration?

When I'm getting information about php I get:


  PHP Version 4.2.2

  System Linux stripples.devel.redhat.com 2.4.21-1.1931.2.274.entsmp #1
SMP Tue Jun 24 11:18:10 EDT 2003 i686 i686 i386 GNU/Linux
  Build Date Jun 29 2003 16:34:10
  Configure Command './configure' '--host=i386-redhat-linux'
'--build=i386-redhat-linux' '--target=i386-redhat-linux-gnu'
'--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin'
'--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share'
'--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec'
'--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man'
'--infodir=/usr/share/info' '--cache-file=../config.cache'
'--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d'
'--enable-force-cgi-redirect' '--disable-debug' '--enable-pic'
'--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-db3'
'--with-curl' '--with-dom=/usr' '--with-exec-dir=/usr/bin'
'--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd'
'--enable-gd-native-ttf' '--with-ttf' '--with-gdbm' '--with-gettext'
'--with-ncurses' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr'
'--with-openssl' '--with-png' '--with-pspell' '--with-regex=system'
'--with-xml' '--with-expat-dir=/usr' '--with-zlib' '--with-layout=GNU'
'--enable-bcmath' '--enable-exif' '--enable-ftp' '--enable-magic-quotes'
'--enable-safe-mode' '--enable-sockets' '--enable-sysvsem'
'--enable-sysvshm' '--enable-discard-path' '--enable-track-vars'
'--enable-trans-sid' '--enable-yp' '--enable-wddx' '--without-oci8'
'--with-pear=/usr/share/pear' '--with-imap=shared' '--with-imap-ssl'
'--with-kerberos=/usr/kerberos' '--with-ldap=shared'
'--with-mysql=shared,/usr' '--with-pgsql=shared' '--with-snmp=shared,/usr'
'--with-snmp=shared' '--enable-ucd-snmp-hack' '--with-unixODBC=shared'
'--enable-memory-limit' '--enable-bcmath' '--enable-shmop'
'--enable-versioning' '--enable-calendar' '--enable-dbx' '--enable-dio'
'--enable-mcal' '--with-apxs2=/usr/sbin/apxs'
  Server API Apache 2.0 Filter
  Virtual Directory Support disabled
  Configuration File (php.ini) Path /etc/php.ini
  Scan this dir for additional .ini files /etc/php.d
  additional .ini files parsed /etc/php.d/imap.ini,
  /etc/php.d/ldap.ini

  Debug Build no
  Thread Safety disabled

   This program makes use of the Zend Scripting Language Engine:
  Zend Engine v1.2.0, Copyright (c) 1998-2002 Zend Technologies






PHP 4 Credits




Configuration
PHP Core
  Directive Local Value Master Value
  allow_call_time_pass_reference
 On On
  allow_url_fopen
 1 1
  always_populate_raw_post_data
 0 0
  arg_separator.input
  
  arg_separator.output
  
  asp_tags
 Off Off
  auto_append_file
 no value no value
  auto_prepend_file
 no value no value
  browscap
 no value no value
  default_charset
 no value no value
  default_mimetype
 text/html text/html
  define_syslog_variables
 Off Off
  disable_functions
 no value no value
  display_errors
 On On
  display_startup_errors
 Off Off
  doc_root
 no value no value
  enable_dl
 On On
  error_append_string
 no value no value
  error_log
 no value no value
  error_prepend_string
 no value no value
  error_reporting
 2039 2039
  expose_php
 On On
  extension_dir
 /usr/lib/php4 /usr/lib/php4
  file_uploads
 1 1
  gpc_order
 GPC GPC
  highlight.bg
 #FF #FF
  highlight.comment
 #FF9900 #FF9900
  highlight.default
 #CC #CC
  highlight.html
 #00 #00
  highlight.keyword
 #006600 #006600
  highlight.string
 #CC #CC
  html_errors
 On On
  ignore_user_abort
 Off Off
  implicit_flush
 Off Off
  include_path
 .:/usr/share/pear .:/usr/share/pear
  log_errors
 Off Off
  magic_quotes_gpc
 On On
  magic_quotes_runtime
 Off Off
  magic_quotes_sybase
 Off Off
  max_execution_time
 30 30
  memory_limit
 8M 8M
  open_basedir
 no value no value
  output_buffering
 no value no value
  output_handler
 no value no value
  post_max_size
 8M 8M
  precision
 14 14
  register_argc_argv
 On On
  register_globals
 Off Off
  safe_mode
 Off Off
  safe_mode_exec_dir
 no value no value
  

[PHP-DB] mysql table join

2003-11-20 Thread Roger Miranda (Sumac)
Hey everyone..

Is there a way to permanently join/link two mysql tables?

Thanks,
Roger

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



Re: [PHP-DB] Access db

2003-11-20 Thread Michael Mauch
Luke Van Blerk wrote:

 I'll probably just extract the data with an access to mysql script and run
 it on mysql.

This is probably the best approach if you have access to Windows
machine. If not, http://freshmeat.net/projects/mdbtools/ might help.

Regards...
Michael

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



Re: [PHP-DB] mysql table join

2003-11-20 Thread CPT John W. Holmes
From: Roger Miranda (Sumac) [EMAIL PROTECTED]

 Is there a way to permanently join/link two mysql tables?

Not without creating another table. 

CREATE TABLE MyTable SELECT ... FROM Table1 JOIN Table2 ON ... WHERE ...

Although I have to wonder about your schema if you need to do this. 

---John Holmes...

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



Re: [PHP-DB] Unsure of how to perform query and results..

2003-11-20 Thread CPT John W. Holmes
From: Aaron Wolski [EMAIL PROTECTED]

 I have data in a Db that looks something like:

 14,[EMAIL PROTECTED],Andrew,Smith
 1,[EMAIL PROTECTED],Andrew,Smith
 14,[EMAIL PROTECTED],Barbara,Richardson
 1,[EMAIL PROTECTED],Barbara,Richardson

 The number represents a product_id that was purchased by the customer in
 question. As you can see from this example.. I have a two customers who
 purchased two different products.

 What I NEED to do is have one entry for each customer but with both
 their product_id in the same result. For example:

 14,1,[EMAIL PROTECTED],Andrew,Smith

 ANY clue how I could go about getting this to work? I'm very desperate
 and running out of time :-(

Sorry, it's not going to happen and besides, there isn't any reason you
should need to return a row like that. How about you tell us what you're
actually trying to do and someone can help you clean up your method...

---John Holmes...

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



Re: [PHP-DB] Read file

2003-11-20 Thread Ng Hwee Hwee
hi neil,

this is indeed a very helpful piece of code and advice.. thank you so much!
if this
took you 30 minutes to write, it would have taken me a day to learn XML, and
start writing! this code looks complicated for a young programmer like me
;p.. i'll need time to read up on XML and get back to you again if i have
queries about the codes..

you really helped cut my learning curve in XML and at the same time solve my
client-server problem.. may you be blessed just like how your codes have
blessed me! :o)

thanx lots,
Hwee Hwee


- Original Message -
From: Neil Smth [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Thursday, November 20, 2003 4:02 AM
Subject: Re: [PHP-DB] Read file


 It's usually easier to show with an example : This took about 30 minutes
to
 write :

 Here's an XML file - copy and paste, and save as hotels.xml :

 ?xml version=1.0?
 hotels
  hotel
  id1/id
  nameBangkok oriental/name
  address50 High Street, Kowloon/address
  phone+12 451 708 3282/phone
  /hotel
  hotel
  id2/id
  nameHilton Marriott/name
  address2042 Michael Wood Street/address
  phone+44 238 9125467/phone
  /hotel
  hotel
  id3/id
  nameSwallow Royal/name
  address91-97 Royal Fort Crescent/address
  phone+01 1209 432 2345/phone
  /hotel
 /hotels

 At 10:21 19/11/2003 +, you wrote:

 Hi Neil,
 
 thank you so much for your advice! i have not programmed XML before so it
 will take me a while to learn it.. your suggestion sounds really
fantastic,
 expecially the part when i don't even have to ask the users to direct me
to
 the file that i need..
 
 my problem, simply put will be:
 1) user has to enter details in a form
 2) when user enters HotelCode in one of the fields in the  form,
 3) javascript must pass the value to PHP to search for the HotelName,
 HotelAddress, HotelTel etc..

 Forget about PHP if you are doing this client side, you only need it to
 process the updated records :

  5) javascript place those values in the respective fields
 6) user continues to complete the form

 Here is a processing page which will populate the form using the XML data
:
 Save this in the same directory you placed the hotels.xml file; It will
 work in IE5 as is :

 html
 head
  titleDemo Hotel Loader/title
 /head

 body onload=populatelist()
 script language=javascript1.2
 !--
 oxmlDocument = new ActiveXObject(MSXML2.DOMDocument);
 oxmlDocument.load(hotels.xml);

 function populatelist() {
  var hotels=oxmlDocument.selectNodes(/hotels/hotel);
  if (hotels != null) {
  d=document.forms[hotelupdate].list;
  d.length=0;
  d[0]=new Option('--Please Select--','',true);
  for (i=0;ihotels.length;i++) {
  d.length++;
  d[i+1]=new Option();

d[i+1].value=hotels[i].selectSingleNode(id).text;

d[i+1].text=hotels[i].selectSingleNode(name).text;
  }
  }
 }

 function populatevalues() {
  d=document.forms[hotelupdate];
 // Get hotel ID #
  v=d.list[d.list.selectedIndex].value;
 // Use this to read the hotel/phone node having this hotel ID

field=oxmlDocument.selectSingleNode(/hotels/hotel[id='+v+']/phone);
 // Set form's phone field to the text of this node
  d.phone.value=field.text;
 // Now to read the hotel/address node having this hotel ID

field=oxmlDocument.selectSingleNode(/hotels/hotel[id='+v+']/address);
 // Set form's address field to the text of this node
  d.address.value=field.text;
 }
 //--
 /script

 form name=hotelupdate id=hotelupdate action=post
 method=http://www.my-server.com/myurl.php; onsubmit=alert('This would
 send these values to your website');return false;
 select name=list id=list onchange=populatevalues()/select Phone
:
 input type=text name=phone id=phone size=15 maxlength=24 /
 br /
 textarea name=address id=address rows=3 cols=40
 wrap=virtual/textarea
 br /
 input type=submit name=submit id=submit value=Send ! /
 /form

 /body
 /html

 You then need to write some PHP to accept the new record (you might give
 the ID number from your database as the primary key). Writing out XML from
 PHP works exactly the same as writing out HTML. You just fill in the
blanks
 with your data by running a query and printing out the values between the
 tags, in a loop.

 Hope that helps - study the code and see if you can understand how it
works.
 Cheers - Neil.

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


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



[PHP-DB] Strange bahavior with mysql_fetch_array($result)

2003-11-20 Thread Evan Panagiotopoulos
I am searching a table and have the following php code with my
comments:

$result = mysql_query($query);
print The result == $result; 
// it returns The result == Resource id #2
if (!mysql_fetch_array($result)) {
 ...
} else {
  while ($row = mysql_fetch_array($result)) {
  ...
   }
}
Neither the if nor the while get executed. 
Can you make any suggestions? Obviously I'm new to this.

Evan

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



Re: [PHP-DB] Strange bahavior with mysql_fetch_array($result)

2003-11-20 Thread Gerard Samuel
On Thursday 20 November 2003 08:54 pm, Evan Panagiotopoulos wrote:
 I am searching a table and have the following php code with my
 comments:

 $result = mysql_query($query);
 print The result == $result;
 // it returns The result == Resource id #2
 if (!mysql_fetch_array($result)) {
  ...
 } else {
   while ($row = mysql_fetch_array($result)) {
   ...
}
 }

Try -
$result = mysql_query($query);
// Test to see if the query failed
if ($result === false)
{
   die('some meaningful message');
}

// Test to see if there are results to return
if (mysql_num_rows($result)  0)
{
// Get results
while($row = mysql_fetch_array($result))
{

}
}
else
{
echo 'No Results';
}

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



[PHP-DB] Re: Strange bahavior with mysql_fetch_array($result)

2003-11-20 Thread Kirk Babb
Hi Evan,

Try something like this instead:

$query = mysql_query(SELECT product_id, product_name, purchase_date from
MyTable ORDER BY product_id  DESC);
if(!$query) {
echo mysql_errno() . :  . mysql_error() . \n;
die;
} else {
//Now, for fun, display the results in a table with the results linked to a
product information page
   print table;
   while($row=mysql_fetch_array($query)) {
   print tr;
   print tda
href=product_details.php?product_id=$row[product_id] .
$row[product_name] .   . $row[purchase_date] . /a/td;
   print /tr;
   }
  print /table;
}
?

NOTE: this is not a tested example, and I didn't check it for accuracy.  I
just threw something together to give you some good ideas of where to go
with your code.  I strongly urge you to use the manual (php.net) just to
browse through the available functions.  Good luck!

HTH,
Kirk


Evan Panagiotopoulos [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I am searching a table and have the following php code with my
 comments:

 $result = mysql_query($query);
 print The result == $result;
 // it returns The result == Resource id #2
 if (!mysql_fetch_array($result)) {
  ...
 } else {
   while ($row = mysql_fetch_array($result)) {
   ...
}
 }
 Neither the if nor the while get executed.
 Can you make any suggestions? Obviously I'm new to this.

 Evan

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



Re: [PHP-DB] Strange bahavior with mysql_fetch_array($result)

2003-11-20 Thread Shahmat Dahlan
What of the sql statement? If your sql statement had mistakes in it (be 
it typo, or wrongly constructed statements), it will not even execute 
the if (!mysql_fetch_array($result)) {  } portion of your code. You 
might want to construct your error checking portion differently as 
opposed to what you have now.

Gerald Samuel's and Kirk Babb's code should fit your requirements.

Gerard Samuel wrote:

On Thursday 20 November 2003 08:54 pm, Evan Panagiotopoulos wrote:
 

I am searching a table and have the following php code with my
comments:
$result = mysql_query($query);
print The result == $result;
// it returns The result == Resource id #2
if (!mysql_fetch_array($result)) {
...
} else {
 while ($row = mysql_fetch_array($result)) {
 ...
  }
}
   

Try -
$result = mysql_query($query);
// Test to see if the query failed
if ($result === false)
{
  die('some meaningful message');
}
// Test to see if there are results to return
if (mysql_num_rows($result)  0)
{
   // Get results
   while($row = mysql_fetch_array($result))
   {
   
   }
}
else
{
   echo 'No Results';
}
 



[PHP-DB] SQLite

2003-11-20 Thread Bronislav Kluka
Hi, I was trying to work with SQLite, everything is OK, but it seems not to
vork in thread, but in sequences. I mean: I perform a question which tooks 2
minutes, then another, which tooks 3 minutes, then I perform them both from
2 separated browser windows and both of them stops at the same time and both
of them tooks 5 minutes so it looks like it do not perform the queries in
threads.
Does anybody know, what does it means???

Bronislav Klucka

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