PDA

View Full Version : سوال: مشکل در حذف داده از mysql



esteftaats
پنج شنبه 07 فروردین 1393, 14:24 عصر
سلام دوستان.

عیدتون مبارک
می خوام یه داده رو از دیتابیس حذف کنم اما متاسفانه ارور میده.
کسی می دونه مشکل از کجاست؟




<?php
session_start();
include "classes/head.html";
include "classes/menu-class.php";
$recieve = $_GET['a'];
$db = mysql_connect("localhost","root","");
mysql_query("SET NAMES 'utf8'", $db);
mysql_query("SET CHARACTER SET utf8", $db);
mysql_query("SET CHARACTER_SET_CONNECTION=utf8", $db);
if ($db)
{
$sdb = mysql_select_db('narcis',$db);
if($sdb)
{
$result=mysql_query("DELETE sentences WHERE url='$recieve'");
if (!$result)
die('Error: ' . mysql_error($db));
else
echo "the sentence has been deleted";
mysql_close($db);
}
else
echo "not select database";
}
else
echo "not connect";
?>
</body>
</html>


اروری که میده اینه :


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 'WHERE url='1'' at line 1

Veteran
پنج شنبه 07 فروردین 1393, 14:57 عصر
DELETE FROM `sentences` WHERE `url`='$recieve'

esteftaats
پنج شنبه 07 فروردین 1393, 15:13 عصر
DELETE FROM `sentences` WHERE `url`='$recieve' تشکر درست شد