MySQL Forums
Forum List  »  PHP

You have an error in your SQL syntax; check the manual that corresponds to ypur My SQL CATID='1" at line 1
Posted by: Sudit Gupta
Date: October 02, 2015 01:08AM

<?php
include "../../db_auth.php";
?>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="pragma" content="nocache">
<meta http-equiv="expires" content="now">

<title>Administrator Zone</title>
<link type="text/css" rel="stylesheet" href="../../sub_style.css">
<?php include_once("../../scripts/admin-js.php"); ?>

<script language=javascript>
var activeEl;
function selectUser(iNewsID){
if(activeEl) activeEl.className = "Cell";
activeEl = iNewsID;
activeEl.className = "CellSelected";
parent.activeUserEL = activeEl.id;
}
</script>

</head>
<body topmargin=0 bottommargin=0 rightmargin=0 leftmargin=0 bgcolor=#FFFFFF>


<?php include_once("menu.php"); ?>
<div style="padding-top:8px;height:100%;overflow:auto;" align="center"><?php ?><?php
if (isset($_POST["Update"]) && $_POST["Update"] == "Update") {
$query = "UPDATE student_option SET CATEGORY='" . $_POST["CATEGORY"] . "',TITLE='" . $_POST["TITLE"] . "',EDIT='" . $_POST["EDIT"] . "',EXPORT='" . $_POST["EXPORT"] . "',IMPORT='" . $_POST["IMPORT"] . "',PHOTO='" . $_POST["PHOTO"] . "',SIGNATURE='" . $_POST["SIGNATURE"] . "',PRINT='" . $_POST["PRINT"] . "',PDETAILS='" . $_POST["PDETAILS"] . "',PARTITION='" . $_POST["PARTITION"] . "',STYLE='" . $_POST["STYLE"] . "',PARTNAME='" . $_POST["PARTNAME"] . "' WHERE CATID='" . $_SESSION['STDCATID'] . "'";
$results = mysql_query($query) or die(mysql_error());
$rows = mysql_affected_rows();
if ($rows != "") echo "<div align='center' style='color:#009D00;'>Updated Successfully.</div>";
}
$query1 = "select * from student_option where CATID='" . $_SESSION['STDCATID'] . "'";
$results1 = mysql_query($query1) or die(mysql_error());
$rows1 = mysql_fetch_array($results1);
if ($rows1 == "") {
$query2 = "insert into student_option(`CATID`,`dtCREATED`) values('" . $_SESSION['STDCATID'] . "','$INDIATIME')";
$results2 = mysql_query($query2) or die(mysql_error());
$rows2 = mysql_affected_rows();
$query = "select * from student_option where CATID='" . $_SESSION['STDCATID'] . "'";
$results = mysql_query($query) or die(mysql_error());
$rows = mysql_fetch_array($results);
} else {
$query = "select * from student_option where CATID='" . $_SESSION['STDCATID'] . "'";
$results = mysql_query($query) or die(mysql_error());
$rows = mysql_fetch_array($results);
}
?><?php
<form method="post" id="login" class="form" action="">
<fieldset>
<legend><b>Form Option</b></legend><br/>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<label for="TITLE"><span class="required">Category Title</span></label>
<input id="TITLE" name="TITLE" class="text required" type="text" value="<?php echo $rows['TITLE']; ?>" />
</td>
</tr>
<tr>
<td>
<label for="EDIT"><span class="required">Edit</span></label>
<input id="EDIT" name="EDIT" class="text required" type="radio" value="Y" <?php if($rows["EDIT"]=="Y") echo "checked"; ?> /> Required &nbsp; &nbsp; &nbsp;
<input id="EDIT" name="EDIT" class="text required" type="radio" value="N" <?php if($rows["EDIT"]=="N") echo "checked"; ?> /> Not Required
</td>
</tr>
<tr>
<td>
<label for="EXPORT"><span class="required">Export</span></label>
<input id="EXPORT" name="EXPORT" class="text required" type="radio" value="Y" <?php if($rows["EXPORT"]=="Y") echo "checked"; ?> /> Required &nbsp; &nbsp; &nbsp;
<input id="EXPORT" name="EXPORT" class="text required" type="radio" value="N" <?php if($rows["EXPORT"]=="N") echo "checked"; ?> /> Not Required
</td>
</tr>
<tr>
<td>
<label for="CATEGORY"><span class="required">Category</span></label>
<input id="CATEGORY" name="CATEGORY" class="text required" type="radio" value="Y" <?php if($rows["CATEGORY"]=="Y") echo "checked"; ?> /> Required &nbsp; &nbsp; &nbsp;
<input id="CATEGORY" name="CATEGORY" class="text required" type="radio" value="N" <?php if($rows["CATEGORY"]=="N") echo "checked"; ?> /> Not Required
</td>
</tr>
<tr>
<td>
<label for="IMPORT"><span class="required">Import File Option</span></label>
<input id="IMPORT" name="IMPORT" class="text required" type="radio" value="Y" <?php if($rows["IMPORT"]=="Y") echo "checked"; ?> /> Required &nbsp; &nbsp; &nbsp;
<input id="IMPORT" name="IMPORT" class="text required" type="radio" value="N" <?php if($rows["IMPORT"]=="N") echo "checked"; ?> /> Not Required
</td>
</tr>
<tr>
<td>
<label for="PHOTO"><span class="required">Upload Photo</span></label>
<input id="PHOTO" name="PHOTO" class="text required" type="radio" value="Y" <?php if($rows["PHOTO"]=="Y") echo "checked"; ?> /> Required &nbsp; &nbsp; &nbsp;
<input id="PHOTO" name="PHOTO" class="text required" type="radio" value="N" <?php if($rows["PHOTO"]=="N") echo "checked"; ?> /> Not Required
</td>
</tr>
<tr>
<td>
<label for="PARTITION"><span class="required">Partition</span></label>
After
<select name="PARTITION" id="PARTITION" class="text required" style="width:50px;">
<option value=''>None</option>
<?php
$output="";
$elements;
$elements[0]="1";
$elements[1]="2";
$elements[2]="3";
$elements[3]="4";
$elements[4]="5";
$elements[5]="6";
$elements[6]="7";
$elements[7]="8";
$elements[8]="9";
$elements[9]="10";
$elements[10]="11";
$elements[11]="12";
$elements[12]="13";
$elements[13]="14";
$elements[14]="15";
for($i=0;$i<sizeof($elements);$i++)
{
$output.= "<option value='".$i."'";
if($rows['PARTITION']=="$i")
{
$output.=" selected ";
}
$output.=">".$elements[$i]."</option>";
}
echo $output;

?>
</select>
&nbsp; &nbsp;
Top
<select name="STYLE" id="STYLE" class="text required" style="width:100px;">
<option value=''>-- Nothing --</option>
<?php
$output1="";
$elements1;
$elements1[0]="Without Style";
$elements1[1]="With Style";
for($i=0;$i<sizeof($elements1);$i++)
{
$output1.= "<option value='".$i."'";
if($rows['STYLE']==$i)
{
$output1.=" selected ";
}
$output1.=">".$elements1[$i]."</option>";
}
echo $output1;

?>
</select>
&nbsp; &nbsp;
Heading
<input id="PARTNAME" name="PARTNAME" class="text required" type="text" value="<?php print_r($rows['PARTNAME']); ?>" />
</td>
</tr>
<tr>
<td>
<label for="SIGNATURE"><span class="required">Signature</span></label>
<input id="SIGNATURE" name="SIGNATURE" class="text required" type="radio" value="Y" <?php if($rows["SIGNATURE"]=="Y") echo "checked"; ?> /> Required &nbsp; &nbsp; &nbsp;
<input id="SIGNATURE" name="SIGNATURE" class="text required" type="radio" value="N" <?php if($rows["SIGNATURE"]=="N") echo "checked"; ?> /> Not Required
</td>
</tr>
<tr>
<td>
<label for="PRINT"><span class="required">Print Button</span></label>
<input id="PRINT" name="PRINT" class="text required" type="radio" value="Y" <?php if($rows["PRINT"]=="Y") echo "checked"; ?> /> Required &nbsp; &nbsp; &nbsp;
<input id="PRINT" name="PRINT" class="text required" type="radio" value="N" <?php if($rows["PRINT"]=="N") echo "checked"; ?> /> Not Required
</td>
</tr>
<tr>
<td>
<label for="PDETAILS"><span class="norequired">Details on Page</span></label>
<textarea style="height: 160px;" cols="80" id="PDETAILS" name="PDETAILS"><?php echo $rows["PDETAILS"]; ?></textarea>
</td>
</tr>
</table>
</fieldset><br/>

<div align="center">
<input type="submit" value="Update" name="Update" style="cursor:hand;margin-left:0px;" class='btn'>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
<input type="reset" name="RESET" value="Reset" size="27" class='btn'>
</div>
<br/>
</form>

</body>
</html>

Options: ReplyQuote


Subject
Written By
Posted
You have an error in your SQL syntax; check the manual that corresponds to ypur My SQL CATID='1" at line 1
October 02, 2015 01:08AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.