PDA

View Full Version : سوال: مشکل این کد چیه؟



pouyandesign
شنبه 30 مرداد 1389, 23:56 عصر
سلام
مخواستم بدونم مشکل این کد چیه که از خط 30 ایراد میگیره ؟؟/


<!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>Untitled Document</title>
</head>
<body>
<?php
include("conf.php");
$con = mysql_connect("localhost","pouyan","145414");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("ied", $con);
$sh=$_POST["hidden"];
$mode=$_GET["mode"];
if($mode=="adding")
{
$code=$_POST["code"];
$ResultRs = mysql_query("SELECT * FROM selected ");
for($i = 1 ; $i<16 ;$i++)
{ $FieldName = mysql_field_name($ResultRs,$i);
$result = mysql_query("SELECT * FROM Persons
WHERE $FieldName='0'");
if ( isset($result))
{ $sql="UPDATE selected SET $FieldName ='$code'
WHERE stnum = '$sh';
} header("location: userinfo.php");
}
} elseif($mode=="deleting") {
$code=$_POST["code"];
$sh=$_POST["hidden"];
$sn=$_POST["sn"];
$sql="UPDATE selected WHERE shortname='$shortname' where stnum='$sh'";
//echo $sql;
$result=mysql_query($sql,$connection) or die(mysql_error());
header("location: userinfo.php");
}?>
</body>
</html>

binyaft
یک شنبه 31 مرداد 1389, 09:31 صبح
دیگه فکر نکنم ایراد بگیره !

<!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>Untitled Document</title>
</head>
<body>
<?php
include("conf.php");
$con = mysql_connect("localhost","pouyan","145414");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("ied", $con);
$sh=$_POST["hidden"];
$mode=$_GET["mode"];
if($mode=="adding")
{
$code=$_POST["code"];
$ResultRs = mysql_query("SELECT * FROM selected ");
for($i = 1 ; $i<16 ;$i++)
{ $FieldName = mysql_field_name($ResultRs,$i);
$result = mysql_query("SELECT * FROM Persons
WHERE $FieldName='0'");
if ( isset($result))
{ $sql="UPDATE selected SET $FieldName ='$code' WHERE stnum = '$sh'";
} header("location: userinfo.php");
}
} elseif($mode=="deleting") {
$code=$_POST["code"];
$sh=$_POST["hidden"];
$sn=$_POST["sn"];
$sql="UPDATE selected WHERE shortname='$shortname' where stnum='$sh'";
//echo $sql;
$result=mysql_query($sql,$connection) or die(mysql_error());
header("location: userinfo.php");
}?>
</body>
</html>

pouyandesign
یک شنبه 31 مرداد 1389, 18:53 عصر
اقا ممنونم اما مشکلم اساسی تر از این حرفاس
http://www.barnamenevis.org/forum/showthread.php?p=1073539#post1073539

SAMAN_PHP
دوشنبه 01 شهریور 1389, 01:17 صبح
غیر از دابل کوتیشن , توی اپدیت دومی بجای set نوشتین WHERE