Apostrophe and line break problems

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
SpaceshipSpaceship
Watch

baris22

Established Member
Impact
1
When I try to insert a sentence with an apostrophe or line break to the database I get an error.

PHP:
{
	$sql_query = "INSERT INTO `filedetails` (`type`,`title` , `description` , `links` ) 
										  VALUES ('$chosenFileType','$title','$description','$linksCollection')";
	
	$query_result = mysql_query($sql_query) or die(mysql_error());

}

this is the code for inserting into the database.

What can I do to solve this problem?


Thanks all.
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
0
Close
yes, always escape your variables.

PHP:
$chosenFileType = mysql_real_escape_string($chosenFileType);
$title = mysql_real_escape_string($title);
$description = mysql_real_escape_string($description);
$links = mysql_real_escape_string($links);

$sql_query = "INSERT INTO `filedetails` (`type`,`title` , `description` , `links` ) VALUES ('$chosenFileType','$title','$description','$links  Collection')";
 
0
Close
0
Close
i notice you have two types of apostrophes or single quotes (at least on my screen). Might wanna check that.
 
0
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back