Re: [PHP-DB] Text corruption when storing to MySql

2004-10-20 Thread Roger Spears
Gaby T. wrote:
I am running into a problem where as I want to store test form a text field
to a database (MySql in this case, sql type text).
Apparently, if people are cutting and
pasting text from another document (typically MS WORD) into the textfield,
the text gets only partially saved. I am assuming wierd characters are 
being
introduced in this manner (I definitively know this is a problem with 
rounded quotes) and although I am using the basic addslashes function, 
it's not enough.
Has anyone seen this before and is there a fix?
Thanx
Gaby

I believe Tom Rodgers from the PHP general list provided this answer 
when I posted a similar question about a year ago...

$submitted_text = $_POST['textFromTextArea'];
function clean_ms_word($writing)
  {
$crap = 
array(chr(0x82),chr(0x83),chr(0x84),chr(0x85),chr(0x86),chr(0x87),chr(0x88),chr(0x89),chr(0x8a),chr(0x8b),chr(0x8c),chr(0x91),chr(0x92),chr(0x93),chr(0x94),chr(0x95),chr(0x96),chr(0x97),chr(0x98),chr(0x99),chr(0x9a),chr(0x9b),chr(0x9c),chr(0x9f));
$clean = 
array('lsquor;','fnof;','ldquor;','ldots;','dagger;','Dagger;','','permil;','Scaron;','lsaquo;','OElig;','lsquo;','rsquo;','quot;','quot;','bull;','ndash;','mdash;','tilde;','trade;','scaron;','rsaquo;','oelig;','Yuml;');
$content = str_replace($crap,$clean,$writing);
return $content;
  }

$usable = clean_ms_word($submitted_text);
This has worked wonderfully for my applications!
Thanks,
Roger
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Text corruption when storing to MySql

2004-10-20 Thread Roger Spears
I missed a variable in my previous postshould have been this:
$submitted_text = $_POST['textFromForm'];
function clean_ms_word($submitted_text)
  {
$crap = 
array(chr(0x82),chr(0x83),chr(0x84),chr(0x85),chr(0x86),chr(0x87),chr(0x88),chr(0x89),chr(0x8a),chr(0x8b),chr(0x8c),chr(0x91),chr(0x92),chr(0x93),chr(0x94),chr(0x95),chr(0x96),chr(0x97),chr(0x98),chr(0x99),chr(0x9a),chr(0x9b),chr(0x9c),chr(0x9f));
$clean = 
array('lsquor;','fnof;','ldquor;','ldots;','dagger;','Dagger;','','permil;','Scaron;','lsaquo;','OElig;','lsquo;','rsquo;','quot;','quot;','bull;','ndash;','mdash;','tilde;','trade;','scaron;','rsaquo;','oelig;','Yuml;');
$content = str_replace($crap,$clean,$writing);
return $content;
  }

$usable = clean_ms_word($submitted_text);
HTH,
Roger
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] password generator

2003-12-10 Thread Roger Spears
Here's one I've used recently with success

http://www.devhood.com/tools/tool_details.aspx?tool_id=784

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


[PHP-DB] OCIBindByName Help Needed

2003-10-20 Thread Roger Spears
Hello,

I've been working on this all day. I'm trying to insert some text 
($essay) into a CLOB field (essay) in my table (clob_test).

Can someone please tell me why the following PHP code returns ORA-01036: 
illegal variable name/number?  Better yet, please tell me how to fix it??

$DB_Resource = OCIPLogon($user,$pass,$db);

$Clob = OCINewDescriptor($DB_Resource, OCI_D_LOB);

$Query_Resource = OCIParse($DB_Resource, INSERT INTO clob_test 
(firstName,lastName,essay) VALUES ('Roger','Dodger','$essay'));

OCIBindByName($Query_Resource, ':essay', $Clob, -1, OCI_B_CLOB);

OCIExecute($Query_Resource, OCI_DEFAULT);

$Clob-free();

OCIFreeStatement($Query_Resource);

Please help preserve my sanity,
Roger


[PHP-DB] ORA-01704: string literal too long AND PHP/PEAR

2003-10-17 Thread Roger Spears
 Ok all of you Oracle experts out there, I've had one heck of a day 
wrestling with this oracle stuff.  My experience with Oracle is turning 
into a greek tragedy.

I'm using PHP/PEAR to execute my queries on an oracle table. I'm trying 
to store very long pieces of text into a CLOB field. Currently I'm 
getting a string too long error.

I've googled to find that there are certain limits when inserting into a 
table. The CLOB datafield may hold 4 gigs of text, but you may only 
insert 4000 bytes at a time. Or at least that's how I understand it.

Anyone got a work around for this?

I've tried:
OCIBindByName($sql,:fieldName,$myVariable, -1);
But I'm not sure I'm using it correctly with PEAR.  In my code, I have 
my sql statement, then I do the OCIBindByName() call, then I do my insert. 

But, this gets me:
ocibindbyname(): supplied argument is not a valid OCI8-Statement resource
Which is an actual PHP/PEAR errorI think...

Anyone out there have any work around suggestions? I really dont want to 
parse the insert statement into pieces each being less then 4000 bytes.

Thanks,
R


[PHP-DB] What is this Mealer Deamon message?

2003-10-17 Thread Roger Spears
I sent a post earlier..and got this in reply...

Hi. This is the qmail-send program at pb1.pair.com.
I'm afraid I wasn't able to deliver your message to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out.
[EMAIL PROTECTED]:
This message is looping: it already has my Delivered-To line. (#5.4.6)
WTF is this?  WTF does it mean? 

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


[PHP-DB] Oracle Auto_Increment Error

2003-10-14 Thread Roger Spears
Hello,

BACKGROUND:
I'm able to create tables in oracle, populate fields in oracle tables, 
select, retrieve and update fields in oracle.  So I know my connection 
code is working.

PROBLEM:
I'm working with PHP and PEAR and I'm trying to create an auto_increment 
field in an oracle database table.  The table has 3 fields and they are 
id, firstName, and lastName.  Below I have included my code for 
creating, sequencing and triggering the table.  I'm also including my 
insert statement which is currently creating an error.  All I get is DB 
Error: unknown error.  Can anyone please tell me why this error is 
being generated?

CODE:
//
// This will create table
//
$sql = CREATE TABLE test (id INT NOT NULL PRIMARY KEY, firstName 
VARCHAR(255) NOT NULL, lastName VARCHAR(255) NOT NULL);

$result = $db-query($sql);
if (DB::isError($result)) {
die ($result-getMessage());
}
//
// sequence
//
$sql = CREATE SEQUENCE test_seq start with 1 increment by 1 nomaxvalue;
$result = $db-query($sql);
if (DB::isError($result)) {
die ($result-getMessage());
}
//
// trigger
//
$sql = CREATE TRIGGER test_trigger before insert on test for each row 
begin select test_seq.nextval into :new.id from dual;
$result = $db-query($sql);
if (DB::isError($result)) {
die ($result-getMessage());
}

//#
// insert
//#
$sql = INSERT INTO test (firstName,lastName) VALUES ('Roger', 'Dodger');
$result = $db-query($sql);
if (DB::isError($result)) {
  die ($result-getMessage());
}
Thanks in advance,
Roger
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] 'while' not picking up on first DB record

2003-09-17 Thread Roger Spears
Hello,

Can anyone from the lists please tell me why this bit of code is not 
picking up on the first record in the database?  If the 'id' I'm looking 
for is '1' it doesn't populate the _SESSION variables.  Any 'id' greater 
then '1' will populate the _SESSION variables.

$q = SELECT * FROM employee;
$r = mysql_query($q);
$row = mysql_fetch_array($r);
while ($row = mysql_fetch_array($r))
 {
   if ($employee == $row[id])
   {
   $_SESSION['dear'] = $row[last_name];
   $_SESSION['to_email'] = $row[email];
   }
 }
Thanks,
Roger
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] SOLVED= 'while' not picking up on first DB record

2003-09-17 Thread Roger Spears
I'm sorry for the double post.  Other then letting both lists know this 
was solved, it won't happen again.  Sorry.

Thank you for the solution!

I new it was simple.  I've been staring at it too long.  Fresh eyes 
always helps!

Thanks again,
Roger
You are making the fetch twice, and not using the first fetch.

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


[PHP-DB] Oracle and PHP

2003-08-22 Thread Roger Spears
Hello,

I was wondering if there are any PHP people out there that are really 
into using Oracle databases?  I've always used mysql but now I find 
myself in a situation that requires the use of an Oracle database.

I've printed out the information posted by Thies C. Arntzen titled 
Making Efficient use of Oracle8i thru Apache and PHP 4 but I was 
wondering if I may see some other code examples.  Very basic examples 
dealing with connections, queries and the such.  Also, is there an 
application for Oracle databases that is similar to PHPMyAdmin for mysql 
databases?

Thanks,
Roger


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


[PHP-DB] test, please delete

2003-08-14 Thread Roger Spears
test, please delete



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