RE: [PHP] Help with SQL Query String

From: Date: Thu, 31 Mar 2005 15:05:45 +0000
Subject: RE: [PHP] Help with SQL Query String
Groups: php.general 
Request: Send a blank email to php-general+get-211962@lists.php.net to get a copy of this message
[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.

« previous php.general (#211962) next »