Parašė citni· 2012 Bir. 19 18:06:46
#1
Taigi, susikūręs teksto įvedimo į duomenų bazę formą, bandau įvesti tekstą su kabutėm (pvz.: Don't Stop) ir man išmeta tokią klaidą:
"Error: You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near '','assdad')' at line 3"
Štai kodo fragmentas:
<?php
include 'connect.php';
$con = mysql_connect ("$db_host","$db_username","$db_pass") or die ("Could nor connect to <span style="border-bottom: 1px dotted black;">MySQL</span>");
@mysql_select_db("$db_name") or die ("No database");
$sql = "INSERT INTO films_trailers (id, name, link)
VALUES
('','".$_POST['name']."','".$_POST['link']."')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "<center><b>Film was successfuly added!</b></center>";
echo "<center><b><a href='index.php'>Back to Home</a></b></center>";
mysql_close($con);
?>