[PHP-DB] Different character sets

2004-01-20 Thread Christine Clerc
Hi,

My pages collect short texts from different languages through HTML 
forms. The texts are stored in a MySQL database. Then, they are used 
in HTML pages.

Problem 1 : the carriage returns don't show back up.
Problem 2 : The character above chr128 are not coded properly (obviously)
Problem 3 : what about other character sets (russian for example)
Thank you for any information on those subjects.

Christine

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


Re: [PHP-DB] Different character sets

2004-01-20 Thread Muhammed Mamedov
Try Unicode (UTF-8) encoding...
Make charset=utf-8 an your pages


Muhammed Mamedov
turkmenweb.com



- Original Message - 
From: Christine Clerc [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, January 20, 2004 3:59 PM
Subject: [PHP-DB] Different character sets


 Hi,
 
 My pages collect short texts from different languages through HTML 
 forms. The texts are stored in a MySQL database. Then, they are used 
 in HTML pages.
 
 Problem 1 : the carriage returns don't show back up.
 Problem 2 : The character above chr128 are not coded properly (obviously)
 Problem 3 : what about other character sets (russian for example)
 
 Thank you for any information on those subjects.
 
 Christine
 
 -- 
 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] Unsubscribe (mailign lsits in general) question...

2004-01-20 Thread Tristan . Pretty
I've been told by my boss, that the law has changed in relation to 'Opt 
out' options on mailing lists etc...
she tells me that I have to now change all my forms to conform.

She claims that now, each time the user must click the 'remain subscribed' 
link, or we have to remove them from our mailing lists.
Thus changing opt out, to opt in, EACH TIME?
Is this true?

She seems quite sure.

We deal with both European and US clients (world wide to be honest, but 
most other countries don'e care about this.. do they?)

Anyone heard of this before?
Tris...

*
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***



RE: [PHP-DB] Unsubscribe (mailign lsits in general) question...

2004-01-20 Thread Hutchins, Richard
Tris,

Here's what I found on infoworld.com in a very limited search (dated
1/12/04). There is info in there that should provide you with other avenues
of research to clarify your company's responsibility. Here is a relevant
excerpt:

CAN-SPAM [went into effect Jan 1., 2004] requires that spam e-mail include
a working return e-mail address, a valid postal address for the sending
company, a working opt-out mechanism and a relevant subject line. The law
also directs the U.S. Federal Trade Commission (FTC) to study setting up a
national do-not-spam list, similar to the national do-not-call telemarketing
list now in effect.

And the relevant link:
http://infoworld.com/article/04/01/12/HNspamcomply_1.html

So, in a not-so-thorough examination, it does not look like an opt-in link
is required. Although, it would seem that the Federal Trade Commission's
website (www.ftc.com) should provide additional info for the US.

HTH,
Rich

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, January 20, 2004 9:12 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Unsubscribe (mailign lsits in general) question...
 
 
 I've been told by my boss, that the law has changed in 
 relation to 'Opt 
 out' options on mailing lists etc...
 she tells me that I have to now change all my forms to conform.
 
 She claims that now, each time the user must click the 
 'remain subscribed' 
 link, or we have to remove them from our mailing lists.
 Thus changing opt out, to opt in, EACH TIME?
 Is this true?
 
 She seems quite sure.
 
 We deal with both European and US clients (world wide to be 
 honest, but 
 most other countries don'e care about this.. do they?)
 
 Anyone heard of this before?
 Tris...
 
 *
 The information contained in this e-mail message is intended only for 
 the personal and confidential use of the recipient(s) named above.  
 If the reader of this message is not the intended recipient 
 or an agent
 responsible for delivering it to the intended recipient, you 
 are hereby 
 notified that you have received this document in error and that any
 review, dissemination, distribution, or copying of this message is 
 strictly prohibited. If you have received this communication 
 in error, 
 please notify us immediately by e-mail, and delete the 
 original message.
 **
 *
 
 

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



Re: [PHP-DB] Unsubscribe (mailign lsits in general) question...

2004-01-20 Thread CPT John W. Holmes
What's this got to do with databases (PHP-DB list)? It's barely related to
PHP to begin with. Think about where your sending your messages before you
click the button.

---John Holmes...

- Original Message - 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, January 20, 2004 9:11 AM
Subject: [PHP-DB] Unsubscribe (mailign lsits in general) question...


 I've been told by my boss, that the law has changed in relation to 'Opt
 out' options on mailing lists etc...
 she tells me that I have to now change all my forms to conform.

 She claims that now, each time the user must click the 'remain subscribed'
 link, or we have to remove them from our mailing lists.
 Thus changing opt out, to opt in, EACH TIME?
 Is this true?

 She seems quite sure.

 We deal with both European and US clients (world wide to be honest, but
 most other countries don'e care about this.. do they?)

 Anyone heard of this before?
 Tris...

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



Re: [PHP-DB] Unsubscribe (mailign lsits in general) question...

2004-01-20 Thread Tristan . Pretty
Sorry, forgot to put the[OT] bit in the subject line...






CPT John W. Holmes [EMAIL PROTECTED] 
20/01/2004 14:27
Please respond to
CPT John W. Holmes [EMAIL PROTECTED]


To
[EMAIL PROTECTED], [EMAIL PROTECTED]
cc

Subject
Re: [PHP-DB] Unsubscribe (mailign lsits in general) question...






What's this got to do with databases (PHP-DB list)? It's barely related to
PHP to begin with. Think about where your sending your messages before you
click the button.

---John Holmes...

- Original Message - 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, January 20, 2004 9:11 AM
Subject: [PHP-DB] Unsubscribe (mailign lsits in general) question...


 I've been told by my boss, that the law has changed in relation to 'Opt
 out' options on mailing lists etc...
 she tells me that I have to now change all my forms to conform.

 She claims that now, each time the user must click the 'remain 
subscribed'
 link, or we have to remove them from our mailing lists.
 Thus changing opt out, to opt in, EACH TIME?
 Is this true?

 She seems quite sure.

 We deal with both European and US clients (world wide to be honest, but
 most other countries don'e care about this.. do they?)

 Anyone heard of this before?
 Tris...

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




*
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***



Re: [PHP-DB] breaking apart data

2004-01-20 Thread CPT John W. Holmes
From: Larry R. Sieting [EMAIL PROTECTED]

 what would be the most efficient way to rework this data in to what I am
 after

 stored text:
 asdf asdf sadl jf lsakdjf a \r\n asdfierw aweiufasd asiuwr \r\n
 asdhfauiweuhrahsd \r\n

 displays text as:
 asdf asdf sadl jf lsakdjf a
 asdfierw aweiufasd asiuwr
 asdhfauiweuhrahsd

 I would like to highlight parts of the above.

What do you mean by highlight it? And how do you know what parts need to
be highlighted??

---John Holmes...

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



Re: [PHP-DB] breaking apart data

2004-01-20 Thread Larry R. Sieting
duh (me)

okay... I am wanting to wrap the lines of text in bullets and perform some 
text formatting on it (highlight, bold, underling, etc..) using css classes

 At 11:12 AM 1/20/2004, you wrote:
From: Larry R. Sieting [EMAIL PROTECTED]

 what would be the most efficient way to rework this data in to what I am
 after

 stored text:
 asdf asdf sadl jf lsakdjf a \r\n asdfierw aweiufasd asiuwr \r\n
 asdhfauiweuhrahsd \r\n

 displays text as:
 asdf asdf sadl jf lsakdjf a
 asdfierw aweiufasd asiuwr
 asdhfauiweuhrahsd

 I would like to highlight parts of the above.
What do you mean by highlight it? And how do you know what parts need to
be highlighted??
---John Holmes...
Larry R. Sieting

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


Re: [PHP-DB] breaking apart data

2004-01-20 Thread Ricardo Lopes
You probably have more luck in a regular expression mailing list. Just an
opinion.

- Original Message -
From: Larry R. Sieting [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, January 20, 2004 4:17 PM
Subject: Re: [PHP-DB] breaking apart data


 duh (me)

 okay... I am wanting to wrap the lines of text in bullets and perform some
 text formatting on it (highlight, bold, underling, etc..) using css
classes


   At 11:12 AM 1/20/2004, you wrote:
 From: Larry R. Sieting [EMAIL PROTECTED]
 
   what would be the most efficient way to rework this data in to what I
am
   after
  
   stored text:
   asdf asdf sadl jf lsakdjf a \r\n asdfierw aweiufasd asiuwr \r\n
   asdhfauiweuhrahsd \r\n
  
   displays text as:
   asdf asdf sadl jf lsakdjf a
   asdfierw aweiufasd asiuwr
   asdhfauiweuhrahsd
  
   I would like to highlight parts of the above.
 
 What do you mean by highlight it? And how do you know what parts need
to
 be highlighted??
 
 ---John Holmes...

 Larry R. Sieting

 --
 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] breaking apart data

2004-01-20 Thread Chris Boget
 duh (me)
 okay... I am wanting to wrap the lines of text in bullets and perform some 
 text formatting on it (highlight, bold, underling, etc..) using css classes

script language=php

  function bulletElements( $arrElement, $key ) {
echo 'li' . $arrElement . '/li';

  }

  $str = asdf asdf sadl jf lsakdjf a \r\n asdfierw aweiufasd asiuwr 
\r\nasdhfauiweuhrahsd \r\n;

  array_walk( explode( \r\n, $str ), 'bulletElements' );

/script

That should do the trick.

Chris

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



RE: [PHP-DB] PHP 4.3.4, ADODB and Oracle9.2

2004-01-20 Thread William Cheung
Thanks,
I found out that the TNS name in ADODB is wrong. After I fixed it, the error
gone.

William Cheung B.Sc, MCSE, MCDBA

Databyte Corp.

-Original Message-
From: Christopher Jones [mailto:[EMAIL PROTECTED] 
Sent: January 19, 2004 12:14 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] PHP 4.3.4, ADODB and Oracle9.2


William Cheung wrote:
 Win 2K server
 IIS 4.0
 PHP 4.3.4
 ADODB 4.10
 Oracle 9.2
 
  
 
 I got the following error
 
 Warning: ociplogon():_oci_open_server: Error while trying to retrieve 
 text for error ORA-12538 in C:\PHPRoot\ADODB\drivers\adodb-oci8.inc.php 
 on line 128

You might be hitting a combination of problems.

I noticed the message Error while trying to retrieve text.  This
means that your ORACLE_HOME is not set properly somewhere, and after
the ORA-12538 occurs Oracle can't look up actual text for it.  Other,
more important things are likely to fail if the environment is not set
properly.

There's a note about the environment variables and Apache in the
Oracle/PHP troubleshooting FAQ:

http://otn.oracle.com/tech/opensource/php/php_troubleshooting_faq.html#envva
rs

It might give some background that applies to IIS too.

As to why the ORA error occurs - I'm not sure yet.  I've seen
ORA-12538 with ADOdb 4.10 in scripts that work with ADOdb 3.60.  See
http://phplens.com/lens/lensforum/msgs.php?id=8330

Chris

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.560 / Virus Database: 352 - Release Date: 1/08/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.560 / Virus Database: 352 - Release Date: 1/08/2004
 

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



[PHP-DB] PHP 4.3.4 ADODB Oracle 9.2

2004-01-20 Thread William Cheung








Hi,

All the system errors are solved. However,
the query seems not returning any rows. I got undefined index error on any
query returns.

Am I hitting the brick wall? Do PHP and ADODB
work with Oracle 9.2? Are there anyone know the answer?



I am using Windows 2K, IIS and Oracle.





William CheungB.Sc, MCSE, MCDBA

Databyte Corp.












---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.560 / Virus Database: 352 - Release Date: 1/08/2004
 

  


Re: [PHP-DB] PHP 4.3.4 ADODB Oracle 9.2

2004-01-20 Thread Christopher Jones


William Cheung wrote:

All the system errors are solved. However, the query seems not returning 
any rows. I got undefined index error on any query returns.

Am I hitting the brick wall? Do PHP and ADODB work with Oracle 9.2? Are 
there anyone know the answer?

I am using Windows 2K, IIS and Oracle.
The script below works for me with W2K, Apache 1.3, PHP 4.3.3 (and 4.3.5RC1)
and ADOdb 4.10.
Chris

-

?php

require_once(adodb.inc.php);

define(ORA_CON_UN, hr);
define(ORA_CON_PW, hr);
define(ORA_CON_DB, );
function error($w, $m)
{
  echo $w: $m;
  die;
}
$db = ADONewConnection(oci8);
if ([EMAIL PROTECTED]Connect(false, ORA_CON_UN, ORA_CON_PW, ORA_CON_DB))
   error('Error connecting', $db-ErrorMsg());
if (!$rs = $db-Execute(SELECT * FROM DUAL))
  error('Error selecting', $db-ErrorMsg());
$row = $rs-FetchRow();
echo pre; var_dump($row); echo /pre;
?

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


[PHP-DB] Re: Subject: Different character sets

2004-01-20 Thread Neil Smth
Regarding carriage returns showing up - this is simple : Look at any HTML 
page source.

You will see it is littered with many carriage returns, long areas with 
many spaces and so on. In HTML, the spaces (more than one) are condensed 
into one space, and carriage returns are not significant sas they would be 
in a standard .txt file.

So, you need to convert the /r/n into HTML line breaks, br /
Luckily, PHP has a function to do this ;-)
Assume your database content is stored in a variable $result, then use
print(nl2br($result));
This will output br / where the newlines are within your content.

About character encoding

(1) Input encoding : You need to specify the encoding of your HTML document 
initially, I suggest using
a meta tag like this :
html
meta http-equiv=Content-Type content=text/html; charset=utf-8

Then (2) , you need to tell your server that the content being posted is in 
a certain range of characters.  You can do this using the FORM element's 
accept-charset tag. This list can be multiple charsets, and is comma or 
space separated

form accept charset=utf-8

So you might want to read up on this
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/properties/acceptcharset.asp
(3) There is some information on russian forms handling here :
http://koi8.pp.ru/frame.html?/htmlforms.html
(4) MySQL has character set support which varies by version. MySQL 4 has 
the best native support, other versions may need some character set support 
to be compiled into the binary. I believe UTF-8 is supported by default, 
which is usually OK in the european / americas regions.

You need to speak to your ISP or techies about this. Some functions may be 
affected by the chosen character sets (eg FULLTEXT searches and so on). See 
more here :

http://www.mysql.com/doc/en/Charset.html

Cheers - Neil Smith.

At 14:03 20/01/2004 +, you wrote:
Date: Tue, 20 Jan 2004 14:59:32 +0100
To: [EMAIL PROTECTED]
From: Christine Clerc [EMAIL PROTECTED]
Content-Type: text/plain; charset=us-ascii ; format=flowed
Subject: Different character sets
Hi,

My pages collect short texts from different languages through HTML forms. 
The texts are stored in a MySQL database. Then, they are used in HTML pages.

Problem 1 : the carriage returns don't show back up.
Problem 2 : The character above chr128 are not coded properly (obviously)
Problem 3 : what about other character sets (russian for example)
Thank you for any information on those subjects.

Christine



CaptionKit http://www.captionkit.com : Production tools
for accessible subtitled internet media, transcripts
and searchable video. Supports Real Player, Quicktime
and Windows Media Player.
VideoChat with friends online, get Freshly Toasted every
day at http://www.fresh-toast.net : NetMeeting solutions
for a connected world.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] breaking apart data

2004-01-20 Thread Larry R. Sieting
Thanks Chris... that worked great.

Guess I need to spend a _lot_ more time reading the manual.

At 11:28 AM 1/20/2004, Chris Boget wrote:
 duh (me)
 okay... I am wanting to wrap the lines of text in bullets and perform some
 text formatting on it (highlight, bold, underling, etc..) using css classes
script language=php

  function bulletElements( $arrElement, $key ) {
echo 'li' . $arrElement . '/li';
  }

  $str = asdf asdf sadl jf lsakdjf a \r\n asdfierw aweiufasd asiuwr 
\r\nasdhfauiweuhrahsd \r\n;

  array_walk( explode( \r\n, $str ), 'bulletElements' );

/script

That should do the trick.

Chris

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

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


[PHP-DB] Update problems

2004-01-20 Thread Kermit Short
I'm trying to update a record in a MSSQL database.  When I execute the
following code on an IIS5 webserver, I get an error message that says:

PHP Warning: odbc_do(): SQL error: [Microsoft][ODBC SQL Server Driver][SQL
Server]Invalid column name 'Tom'., SQL state S0022 in SQLExecDirect in
E:\web\phptest\dbtest.php on line 31

This is after I've submitted the name Tom in the form.  Does anyone have any
ideas?!
Thanks very much in advance!
-Kermit

?php
$fname=$_POST['first'];
if (!(is_null($fname))) {
 if (!($odbccon = odbc_connect(**, **, **))) {
die(pCould not Connect./p);
 }
 else {
  echopConnected to Database./p;
  $sqlupdate=UPDATE UserInfo
 SET ZNum='112763', FirstName=$fname, LastName='Short', TA='00',
Building='1197', Room='112',  Div='FWO', Grp='IIM'
 WHERE ZNum='112763';
  $sqlupdresults=odbc_do($odbccon, $sqlupdate);
  $query=SELECT * FROM UserInfo WHERE ZNum=112763;
  $qresults=odbc_do($odbccon, $query);
  odbc_result_all($qresults, border=1);
  odbc_close($odbccon);
  echo pConnection Closed./p;
 }
}
else {
 ?
 form action=?php echo $_SERVER['PHP_SELF'] ? method=post
name=test
  First Name: input type=text name=first /br /
  input type=submit name=submit /
 /form
 ?php
}
?

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



RE: [PHP-DB] Update problems

2004-01-20 Thread Peter Lovatt
you need quotes around the name

FirstName=$fname

otherwise it takes the value of $fname to be  aa field name

HTH

Peter



-Original Message-
From: Kermit Short [mailto:[EMAIL PROTECTED]
Sent: 20 January 2004 22:28
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Update problems


I'm trying to update a record in a MSSQL database.  When I execute the
following code on an IIS5 webserver, I get an error message that says:

PHP Warning: odbc_do(): SQL error: [Microsoft][ODBC SQL Server Driver][SQL
Server]Invalid column name 'Tom'., SQL state S0022 in SQLExecDirect in
E:\web\phptest\dbtest.php on line 31

This is after I've submitted the name Tom in the form.  Does anyone have any
ideas?!
Thanks very much in advance!
-Kermit

?php
$fname=$_POST['first'];
if (!(is_null($fname))) {
 if (!($odbccon = odbc_connect(**, **, **))) {
die(pCould not Connect./p);
 }
 else {
  echopConnected to Database./p;
  $sqlupdate=UPDATE UserInfo
 SET ZNum='112763', FirstName=$fname, LastName='Short', TA='00',
Building='1197', Room='112',  Div='FWO', Grp='IIM'
 WHERE ZNum='112763';
  $sqlupdresults=odbc_do($odbccon, $sqlupdate);
  $query=SELECT * FROM UserInfo WHERE ZNum=112763;
  $qresults=odbc_do($odbccon, $query);
  odbc_result_all($qresults, border=1);
  odbc_close($odbccon);
  echo pConnection Closed./p;
 }
}
else {
 ?
 form action=?php echo $_SERVER['PHP_SELF'] ? method=post
name=test
  First Name: input type=text name=first /br /
  input type=submit name=submit /
 /form
 ?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] Update problems

2004-01-20 Thread Paul Miller
You might want to use single quotes

FirstName='$fname'

$sqlupdate=UPDATE UserInfo
SET ZNum='112763', FirstName='$fname', LastName='Short', TA='00',
Building='1197', Room='112',  Div='FWO', Grp='IIM'
WHERE ZNum='112763';

- Paul

-Original Message-
From: Peter Lovatt [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 20, 2004 5:17 PM
To: Kermit Short; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Update problems


you need quotes around the name

FirstName=$fname

otherwise it takes the value of $fname to be  aa field name

HTH

Peter



-Original Message-
From: Kermit Short [mailto:[EMAIL PROTECTED]
Sent: 20 January 2004 22:28
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Update problems


I'm trying to update a record in a MSSQL database.  When I execute the
following code on an IIS5 webserver, I get an error message that says:

PHP Warning: odbc_do(): SQL error: [Microsoft][ODBC SQL Server Driver][SQL
Server]Invalid column name 'Tom'., SQL state S0022 in SQLExecDirect in
E:\web\phptest\dbtest.php on line 31

This is after I've submitted the name Tom in the form.  Does anyone have any
ideas?!
Thanks very much in advance!
-Kermit

?php
$fname=$_POST['first'];
if (!(is_null($fname))) {
 if (!($odbccon = odbc_connect(**, **, **))) {
die(pCould not Connect./p);
 }
 else {
  echopConnected to Database./p;
  $sqlupdate=UPDATE UserInfo
 SET ZNum='112763', FirstName=$fname, LastName='Short', TA='00',
Building='1197', Room='112',  Div='FWO', Grp='IIM'
 WHERE ZNum='112763';
  $sqlupdresults=odbc_do($odbccon, $sqlupdate);
  $query=SELECT * FROM UserInfo WHERE ZNum=112763;
  $qresults=odbc_do($odbccon, $query);
  odbc_result_all($qresults, border=1);
  odbc_close($odbccon);
  echo pConnection Closed./p;
 }
}
else {
 ?
 form action=?php echo $_SERVER['PHP_SELF'] ? method=post
name=test
  First Name: input type=text name=first /br /
  input type=submit name=submit /
 /form
 ?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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] What am I doing wrong with pg_copy_from ?

2004-01-20 Thread James Long
Hello!  I'm new to the list.  I'm learning php and PostgreSQL
basics.

I'm having a hard time finding a clean way to 

retrieve a table row;
edit it;
write it back to the table;

Ideally, I'd like to read the row as an associative array, display
an html page that will allow the user to edit thoe array cells (don't
have a handle on that yet), and then update the table row based on
the array as edited by the html client.

Right now, I'd settle for making this work:

I create a table:

DROP TABLE test;

CREATE TABLE test (
field1  varchar(16),
field2  integer,
field3  date
);

INSERT INTO test VALUES ('field 1', 2, '3/3/2003' );

INSERT INTO test VALUES ('FIELD 1', 22, '3/3/2033' );

Great.  I now have:

 field1  | field2 |   field3   
-++
 field 1 |  2 | 2003-03-03
 FIELD 1 | 22 | 2033-03-03
(2 rows)

I point my web browser at this .php script:


?php

$database = pg_connect( dbname=james user=james );

$row_id = field 1;

$query_string = select * from test where (field1 = '$row_id');

echo $query_string . br;

$result = pg_query( $database, $query_string );

if ($result) {

// How many fields are there?  Let there be $j fields
$j = pg_num_fields( $result );
echo $j .  fields foundbr;

// build an array containing that many fields, corresponding in order
// to the order in the SQL table row.  Let that array be called $rec
$rec = array();

$rec[ field1 ] = $row_id;
$rec[ field2 ] = 20;
$rec[ field3 ] = '3-3-2003';
print_r( $rec );
echo br;

// Delete the old record with this row_id
$query_string = delete from test where (field1 = '$row_id');
$result = pg_query( $database, $query_string );

// If delete succeeded, insert a row from our array 
if ($result) {
  if (pg_copy_from( $database, test, $rec )) {
echo pg_copy_from worked!br;
  } else {
echo pg_copy_from failed;
  }
} else {
  echo delete from test failed;
}

} else {
echo select * from test failed;
}

pg_query( $database, end );

?

... and it gives the output:

select * from test where (field1 = 'field 1')
3 fields found
Array ( [field1] = field 1 [field2] = 20 [field3] = 3-3-2003 ) 

Warning: pg_copy_from(): endcopy failed: . in /usr/home/james/public_html/test6.php on 
line 35
pg_copy_from failed


Now my table looks like:

 field1  | field2 |   field3   
-++
 FIELD 1 | 22 | 2033-03-03
(1 row)


So the delete happened okay, but I can't insert a row from my array.

What am I doing wrong?  I'm also game to try updating in place, but
I want to be cmofortable with both methods, either deleting (or otherwise
marking as obsolete) the old and inserting the new, or by just updating 
in place.  There's pg_update, but it is loudly flagged as experimental.
However, I don't see anything that purports to be the traditional
method for updating table rows.

All clues will be appreciated.

Regards,

Jim Long

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