Dynadot โ€” .com Registration $8.99

Apostrophe and line break problems

Spaceship Spaceship
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
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
0
•••
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
•••
0
•••
i notice you have two types of apostrophes or single quotes (at least on my screen). Might wanna check that.
 
0
•••
Unstoppable Domains
Domain Recover
DomainEasy โ€” Live Options
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back