RE: [PHP] Help with INSERT query

From: Date: Wed, 24 Jan 2001 21:49:38 +0000
Subject: RE: [PHP] Help with INSERT query
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-36490@lists.php.net to get a copy of this message
Some of your single quotes between values are missing (the . "','" . ), messing up the query. However it would probably be easier to do the addslashes() beforeyou do the query so you don't have to break the query up like that. So I'd do it like this: }else{ // Insert new entry $Name = addslashes($Name); $Description = addslashes($Description); $FileName = addslashes($FileName); $Redirect = addslashes($Redirect); $query = "INSERT INTO Downloads (Name, Description, FileSize, FileName, DownloadCount, Category, Redirect) VALUES ('$Name', '$Description', '$FileSize', '$FileName', '$DownloadCount', '$Categories', '$Redirect')"; } Thor M. Steindorsson - thor@netwood.net http://www.netwood.net - Find Out Why We're Better. -----Original Message----- From: Darren Evans [mailto:d_evans*@earthlink.net] Sent: Wednesday, January 24, 2001 1:51 PM To: php-general@lists.php.net Subject: [PHP] Help with INSERT query I recently downloaded a phpDownload app. I'm having problems with it and can not reach the creator of this app. The INSERT query from the Admin portion of this app will not insert the info passed from a form. Can someone offer any help with this? Here is a portion of the code: } else { // Insert new entry $query = "INSERT INTO Downloads (Name, Description, FileSize, FileName, DownloadCount, Category, Redirect) VALUES ('"; $query .= addslashes($Name) . "','" . addslashes($Description) . "'," . $FileSize . ",'" . addslashes($FileName) . "'," . $DownloadCount . "," . $Categories . ",'" . addslashes($Redirect) ."')"; } Darren Evans Senior Site Coordinator www.bombs-away.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#36490) next »