[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-general
Subject:    Re: [PHP] Spaces collapsed in database
From:       "Hugh Danaher" <hdanaher () earthlink ! net>
Date:       2003-02-28 17:49:08
[Download RAW message or body]

perhaps you are parsing out the spaces before inserting the vars in the
database?
----- Original Message -----
From: "Alberto Brea" <estudiobrea@fibertel.com.ar>
To: <php-general@lists.php.net>
Sent: Friday, February 28, 2003 7:58 AM
Subject: [PHP] Spaces collapsed in database


Hi, list
I had certain information in a text file, which showed ok upon fopen() and
parsing, but when I put it into a MySQL database, instead of echoing
directly into the browser, the spaces in the strings collapsed, so that "One
Two & Three" became "OneTwo&Three" in the database table. When I retrieve
this the spaces remain collapsed.
Can anybody tell me what I did wrong, or what can I do to prevent this from
happening?
Please find the code below

Thank you,
Alberto

  // QUERY 1: INSERT RECORDS INTO TABLE contacts
  // DEFINE VARIABLES FOR QUERY 1
  $sex=$info[1];
  $lang=$info[2];
  $pretreat=$info[3];
  $fname=$info[4];
  $lname=$info[5];
  $posttreat=$info[6];
  $contabbr=$info[9];
  $persweb=$info[10];
  $idactiv=$info[11];
  $unsubscribe=$info[14];
  $ent=$info[7];
  $city=$info[13];
  $email=$info[8];
  $random=$info[14];

  // DEFINE QUERY 1
  $sql1= "INSERT INTO contacts SET
   sex='$sex',
   lang='$lang',
   pretreat='$pretreat',
   fname='$fname',
   lname='$lname',
   posttreat='$posttreat',
   contabbr='$contabbr',
   persweb='$persweb',
   idactiv='$idactiv',
   unsubscribe='$unsubscribe',
   ent='$ent',
   city='$city',
   email='$email',
   random='$random',
   date= CURDATE()";

  // RUN QUERY 1
  if(!mysql_query($sql1)):
   echo("Unable to add contact: ". mysql_error() . "<br>");
  else:
   echo("Contact added successfully<br>");
  endif;




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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic