masiha68
چهارشنبه 18 بهمن 1391, 14:14 عصر
سلام به همگی
من یه فرم ساختم واسه ویرایش دسته بندی ها سایتم منتها با وجود اینکه ده ها بار کدها رو از اول نوشتم و فرم رو دوباره طراحی کردم بازم ارور میده . شما یه نگاهی بندازین ببین کجای کدم اشتباه
<?php require_once('../Connections/pop.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$lop=$_GET['idcat'];}
mysql_select_db($database_pop, $pop);
$query_showcat = "SELECT * FROM cat where idcat= $lop ";
$showcat = mysql_query($query_showcat, $pop) or die(mysql_error());
$row_showcat = mysql_fetch_assoc($showcat);
$totalRows_showcat = mysql_num_rows($showcat);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ویرایش دسته</title>
</head>
<body>
<form method="post" name="editcat">
<table width="400" border="0" >
<tr>
<td width="295" align="center">اسم دسته </td>
<td width="95" align="center"><a href="cat.php"><input type="button" value="انصراف" /> </a></td>
</tr>
<tr>
<td><input name="catneme" type="text" value="<?php echo $row_showcat['catname']; ?>" size="30" /> </td>
<td align="center"><input type="submit" value="ویرایش" name="editcat" /></td>
</tr>
</table>
</form>
</body>
</html>
<?php
mysql_free_result($showcat);
?>
اینم ارور
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 '' at line 1
من یه فرم ساختم واسه ویرایش دسته بندی ها سایتم منتها با وجود اینکه ده ها بار کدها رو از اول نوشتم و فرم رو دوباره طراحی کردم بازم ارور میده . شما یه نگاهی بندازین ببین کجای کدم اشتباه
<?php require_once('../Connections/pop.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$lop=$_GET['idcat'];}
mysql_select_db($database_pop, $pop);
$query_showcat = "SELECT * FROM cat where idcat= $lop ";
$showcat = mysql_query($query_showcat, $pop) or die(mysql_error());
$row_showcat = mysql_fetch_assoc($showcat);
$totalRows_showcat = mysql_num_rows($showcat);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ویرایش دسته</title>
</head>
<body>
<form method="post" name="editcat">
<table width="400" border="0" >
<tr>
<td width="295" align="center">اسم دسته </td>
<td width="95" align="center"><a href="cat.php"><input type="button" value="انصراف" /> </a></td>
</tr>
<tr>
<td><input name="catneme" type="text" value="<?php echo $row_showcat['catname']; ?>" size="30" /> </td>
<td align="center"><input type="submit" value="ویرایش" name="editcat" /></td>
</tr>
</table>
</form>
</body>
</html>
<?php
mysql_free_result($showcat);
?>
اینم ارور
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 '' at line 1