djfox Posted January 1, 2008 Share Posted January 1, 2008 I get the following error message: 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 'desc, shortname, store, files, layers, gender, posespec, type, cost, spec, date ' at line 1 Here`s admin_clothing_add.php: <?php //Date: December 31 2007 //For: www.secrettrance.net //Description: Admin Panel: Add Clothing include("dbcon.php"); require_once "design.php"; require_once "auth.php"; $Title = "Secret Trance: Admin Panel: Add Clothing"; require_once "header.php"; require_once "hidestatus.php"; if (!isLoggedIn()) { Redirect("index.php"); } ?> <p> <table border=0 width=100% bgcolor="000000"><? //2 ?> <tr> <td background="<? echo "$boxbanner"; ?>"><b>Admin Panel: Add Clothing</b> <tr> <td background="<? echo "$boxback"; ?>"> <?php if ($lev > 7) { ?> <form action="admin_clothing_add2.php"> <b>Name:</b> <br><input type="text" name="title" size="60" maxlength="255"> <p> <b>Description:</b> <br><input type="text" name="des" size="60" maxlength="255"> <p> <b>Short Name:</b> <br><input type="text" name="short" size="60" maxlength="255"> <p> <b>Region:</b> <br><select name="region" style="border: 0px; background-color:#000000; color: #B6ABCE;"> <?php $res = mysql_query("SELECT id, name FROM shops ORDER BY name ASC"); while ( $cats = mysql_fetch_row($res) ){ echo "<option value='$cats[0]'>$cats[1]</option>"; } ?> </select> <p> <b>Files:</b> <font size=2>(Exclude .png extensions. Seperate by ,)</font> <br><input type="text" name="filenames" size="60"> <p> <b>Layers:</b> <font size=2>(Coordinate layer numbers with file names listed above.)</font> <br><input type="text" name="lay" size="60"> <p> <b>Gender:</b> <br><select name="gender" style="border: 0px; background-color:#000000; color: #B6ABCE;"> <option value="b">Both <option value="f">Female <option value="m">Male </select> <p> <b>Is Item Pose Specific?</b> <br><input type="radio" name="pose" value="0"> No <br><input type="radio" name="pose" value="1"> Yes <p> <b>Item Type</b> <br><select name="type" style="border: 0px; background-color:#000000; color: #B6ABCE;"> <?php $res = mysql_query("SELECT id, name FROM categories ORDER BY name ASC"); while ( $cats2 = mysql_fetch_row($res) ){ echo "<option value='$cats2[1]'>$cats2[1]</option>"; } ?> </select> <p> <b>Cost:</b> <br><input type="text" name="price" size="60" maxlength="100"> <p> <b>Is Item Special Item?</b> <br><input type="radio" name="spe" value="0"> No <br><input type="radio" name="spe" value="1"> Yes <p> <input type="image" src="<? echo $butadd ?>" name="submit"> </form> <?php } else{ if ($lev < { header("Location: today.php"); } } ?> </table><? //2 ?> <p> <? require_once "footer.php"; ?> admin_clothing_add2.php: <?php session_start(); //Date: December 31 2007 //For: www.secrettrance.net //Description: Admin Panel: Add Clothing include("dbcon.php"); require_once "design.php"; require_once "auth.php"; $Title = "Secret Trance: Admin Panel: Add Clothing"; require_once "header.php"; require_once "hidestatus.php"; if (!isLoggedIn()) { Redirect("index.php"); } if ($lev > { $entry_date = strftime("%B\ %e\,\ %Y %H:%M:%S", time()); $add="INSERT INTO clothing ( name, desc, shortname, store, files, layers, gender, posespec, type, cost, spec, date ) VALUES ( '$title', '$des', '$short', '$region', '$filenames', '$lay', '$gender', '$pose', '$type', '$price','$spe', '$entry_date' )"; $res = mysql_query($add) or die(mysql_error()); mysql_close($con); //Redirect header("Location: admin_clothing_add.php"); } else{ if ($lev < 9) { header("Location: today.php"); } } ?> Here`s a screenshot of 'clothing' table: Link to comment https://forums.phpfreaks.com/topic/83912-solved-can-someone-check-my-code/ Share on other sites More sharing options...
revraz Posted January 1, 2008 Share Posted January 1, 2008 DESC is a reserved mysql word (opposite of ASC). Change DESC to something else. Link to comment https://forums.phpfreaks.com/topic/83912-solved-can-someone-check-my-code/#findComment-427033 Share on other sites More sharing options...
underparnv Posted January 1, 2008 Share Posted January 1, 2008 It is because you have a field named 'desc'. This is a MySQL reserved word. Either rename that field, or encapsulate your field with the back tick character...e.g.: $add="INSERT INTO clothing ( `name`, `desc`, `shortname`, `store`, `files`, `layers`, `gender`, `posespec`, `type`, `cost`, `spec`, `date` ) VALUES ( '$title', '$des', '$short', '$region', '$filenames', '$lay', '$gender', '$pose', '$type', '$price','$spe', '$entry_date' )"; Enjoy and happy new year! Link to comment https://forums.phpfreaks.com/topic/83912-solved-can-someone-check-my-code/#findComment-427035 Share on other sites More sharing options...
djfox Posted January 1, 2008 Author Share Posted January 1, 2008 DESC is a reserved mysql word (opposite of ASC). Change DESC to something else. Oh I didn`t know that. Thanks very much. That did solve the problem. Link to comment https://forums.phpfreaks.com/topic/83912-solved-can-someone-check-my-code/#findComment-427037 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.