[PHP-DB] Re: Spaces Problem php mysql

2002-05-02 Thread Hugh Bothwell


Paul [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I have a form on one server which takes a name in one field, intentionally
 including spaces as a full name. That value shows up as a form variable as
I
 intended when I display it on the same server. It is sent to another
server
 and written to a mysql database there. At that time, only the first word
in
 the field is written. When the value is returned by the same php script
that
 received and wrote the database, the only thing left in the field is the
 first word. Length of the word seems to have nothing to do with this.

 I've been pounding my head (and the keyboard with searches) over this. Do
I
 have to take the first entry apart with string functions to get my desired
 end, which is the entire name in one field in the database?

... make sure the value is enclosed in quotes when you try
to insert it into the database, ie

INSERT INTO table ( name ) VALUES ( '$name' )



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




Re: [PHP-DB] Re: Spaces Problem php mysql

2002-05-02 Thread szii

- Original Message - 
From: Hugh Bothwell [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, May 02, 2002 6:23 AM
Subject: [PHP-DB] Re: Spaces Problem php  mysql


  I've been pounding my head (and the keyboard with searches) over this. Do
 I
  have to take the first entry apart with string functions to get my desired
  end, which is the entire name in one field in the database?
 
 ... make sure the value is enclosed in quotes when you try
 to insert it into the database, ie
 
 INSERT INTO table ( name ) VALUES ( '$name' )

Make sure you escape out all single quotes in $name.

$name =  This is Paul's field.
.
.
.
INSERT INTO table ( name ) VALUES ( '$name' )

Will fail, because you have VALUES ('This is Paul');

Post the full value of $name via var_dump($name) and
var_dump($query) and we'll see what we can find with it.

'Luck

-Szii


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




Re: [PHP-DB] Re: Spaces Problem php mysql

2002-05-02 Thread szii

AddSlashes() or AddCSlashes()

-Szii

- Original Message - 
From: Paul [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, May 02, 2002 4:11 PM
Subject: Re: [PHP-DB] Re: Spaces Problem php  mysql


 On Thursday 02 May 2002 10:10 am, you wrote:
  - Original Message -
  From: Hugh Bothwell [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Thursday, May 02, 2002 6:23 AM
  Subject: [PHP-DB] Re: Spaces Problem php  mysql
 
I've been pounding my head (and the keyboard with searches) over this.
Do
  
   I
  
have to take the first entry apart with string functions to get my
desired end, which is the entire name in one field in the database?
  
   ... make sure the value is enclosed in quotes when you try
   to insert it into the database, ie
  
   INSERT INTO table ( name ) VALUES ( '$name' )
 
  Make sure you escape out all single quotes in $name.
 
  $name =  This is Paul's field.
  .
  .
  .
  INSERT INTO table ( name ) VALUES ( '$name' )
 
  Will fail, because you have VALUES ('This is Paul');
 
  Post the full value of $name via var_dump($name) and
  var_dump($query) and we'll see what we can find with it.
 
  'Luck
 
  -Szii
 Thank you David and Szii. The urlencode solved the sending problem. But I've 
 had in the back of my mind to remember to deal with apostrophe's in names for 
 some time and just haven't done it. Good reminder. Is there any easier way to 
 do this than looping through each character in a string?
 
 Paul


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




[PHP-DB] Re: Spaces Problem php mysql

2002-05-01 Thread David Robley

In article [EMAIL PROTECTED], [EMAIL PROTECTED] 
says...
 I have a form on one server which takes a name in one field, intentionally 
 including spaces as a full name. That value shows up as a form variable as I 
 intended when I display it on the same server. It is sent to another server 
 and written to a mysql database there. At that time, only the first word in 
 the field is written. When the value is returned by the same php script that 
 received and wrote the database, the only thing left in the field is the 
 first word. Length of the word seems to have nothing to do with this.
 
 I've been pounding my head (and the keyboard with searches) over this. Do I 
 have to take the first entry apart with string functions to get my desired 
 end, which is the entire name in one field in the database?
 
 TIA,
 Paul
 
You will probably need to urlencode it to pass it, especialy as a GET

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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