RE: Help with SQL Query String

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[snip]
$sql = INSERT INTO tblname (USERID,FULLNAME,SSN,STARTDATE) VALUES
(trim($row[USERID]),trim($row[FULLNAME]),trim($row[SSNO]),trim($row[STAR
TDAT
E]));
[/snip]

Time to quote and concatenate and make pretty...

$sql = "INSERT INTO tblname (USERID,FULLNAME,SSN,STARTDATE) ";
$sql .= "VALUES ( ";
$sql .= "'" . trim($row['USERID']) . "', ";
$sql .= "'" . trim($row['FULLNAME']) . "', ";
$sql .= "'" . trim($row['SSNO']) . "', ";
$sql .= "'" . trim($row['STARTDATE']) . "' ";
$sql .= ") ";

This will make things easier to maintain as well.

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux