Lambenstein
Registered
имам следния ерор:
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 ''Little Bad Girl','Lambenstein','1322761234')' at line 1
на ето този код:
Как да го оправя???
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 ''Little Bad Girl','Lambenstein','1322761234')' at line 1
на ето този код:
Код:
<?php
include "config.php";
if ($_SESSION['username'])
{
echo "<form action='' method='post' class='std'>
<p class='required text'>
<label for='customer_firstname'>Artist</label>
<input title='Write Artist Name!' name='ispylnitel' type='text' />
</p>
<p class='required text'>
<label for='email'>Song</label>
<input type='text' id='email' name='pesen' />
</p>
<p class='required text'>
<label for='firstname'>Album</label>
<input type='text' name='album' />
</p>
<p class='required text'>
<label for='lastname'>Year</label>
<input type='text' name='godina' />
</p>
<p class='text'>
<label for='company'>Lyrics</label>
<input type='text' name='textove' />
</p>
<p class='text'>
<label for='company'>Cover(Picture)</label>
<input type='text' name='snimka' />
</p>";
$query = "SELECT * FROM catsmusic";
$result = mysql_query($query) or die (mysql_error());
echo"<p class='select'>
<label for='company'>Category</label>
<select name='kategoria'>";
while($row = mysql_fetch_assoc($result))
{
if($lang == "es")
{
$kategoria = $row['kategoria_es'];
}
if($lang == "en")
{
$kategoria = $row['kategoria_en'];
}
else
{
$kategoria = $row['kategoria'];
}
echo "<option value='$row[id]'>$kategoria</option>";
}
echo "</select></p>";
echo "<p class='required text'>
<label for='city'>Link</label>
<input type='text' name='link' />
</p>
<p class='submit'>
<input type='submit' name='submit' id='submitAccount' value='Register' class='exclusive' />
</p>
</form>";
$ispylnitel = htmlspecialchars($_POST['ispylnitel']);
$kategoria = htmlspecialchars($_POST['kategoria']);
$pesen = htmlspecialchars($_POST['pesen']);
$link = htmlspecialchars($_POST['link']);
$godina = htmlspecialchars($_POST['godina']);
$snimka = htmlspecialchars($_POST['snimka']);
$textove = htmlspecialchars($_POST['textove']);
$album = htmlspecialchars($_POST['album']);
$date = time();
$kachil = $_SESSION['username'];
if(isset($_POST['submit']))
{
$type = $_FILES['song']['type'];
$files = $_FILES['song']['tmp_name'];
$names = $_FILES['song']['name'];
$size = $_FILES['song']['size'];
if($files != NULL)
{
$rand = "song" . rand(0000, 9999) . "-" .rand(00, 99);
$fil = array('mp3');
$fil2 = end(explode('.', $names));
$path = "song/".$rand.".".$fil2;
$fileu = $rand. ".".$fil2;
if(in_array($fil2, $fil))
{
if(move_uploaded_file($files, $path))
{
$msg = "Успешно променихте профила си!";
}
}
else
{
$msg = "Разширението на аватара ви е различено от jpg,png и gif!";
}
}
if ($ispylnitel == NULL || $pesen == NULL || $link == NULL || $kategoria == NULL)
{
echo "<br><br><br><br><center>Не си попълни всички полета!</center>";
}
else
{
//Тука е заявката за да се добавя сайт във базата данни! Ъпдейтват се: Име, Категория, Сайт, Банер, Описание.
$sql = "INSERT INTO music (ispylnitel,kategoria,pesen,link,godina,snimka,textove,album,kachil,date) VALUES ('$ispylnitel','$kategoria','$pesen','$link','$godina','$snimka',$textove,'$album','$kachil','$date')";
mysql_query($sql) or die (mysql_error());
echo "<br><br><br><br><span style='color:white;'><center>Песента <strong>$pesen</strong> на <strong>$ispylnitel</strong> е качена успешно! <b> - <a href='index.php'>Виж всички качени песни</a>.</span><br />";
}
}
}
else
{
echo "<br><br><br><br><center>Не си логнат!</center>";
}
?>
Как да го оправя???