Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

Apostrophe and line break problems

SpaceshipSpaceship
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

Filters for activity feeds
Your news feed, Latest activity, and the activity tab on profiles now have filter buttons: All, Posts, Quick replies, and Other. Your...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back