This should be a valid query not sure why its not running from my funtion though i have tried it directly into my database and it works fine, any suggestions would be appreciated.
Thats my form:
function add_category_form()
{
$catID = $_GET['nodeid'];
echo"
<table border='0' align=center cellspacing='0' cellpadding='0' width='100% height='100%'>
<tr>
<td>
<form name='' method='post' action='?sec=6&treeviewid=treeid&nodeid=$catID' enctype='multipart/form-data'>
<table border='0' cellspacing='2' cellpadding='2' border='0' height='100%' align='center' width='95%'>
<tr>
<td height='20' colspan=3></td>
</tr>
<tr>
<td width='178' class='style13' height='33'> Category Name : *</td>
<td width='413' class='style12' colspan='2' height='33'>
<input type='text' name='cat_name' value='' size='22' maxlength='160' /></td>
</tr>
<tr>
<td width='178' class='style13' height='33'> Enabled:</td>
<td width='413' class='style12' colspan='2'>
<input type='checkbox' name='cat_enable' class='style5'></td>
</tr>
<tr>
<td class='style12'></td>
<td align='left' class='style12' width='153'><input type='submit' name='add' id='add' value='Add'></td>
</tr>
</table>
</form>
</td>
</tr>
</table>";
}
thats my query function:
function add_category()
{
$category_id = $_GET['nodeid'];
$cat_name = $_POST['cat_name'];
//$enabled = $_POST['cat_enable'];
$enter_category = "LOCK TABLE categories WRITE;
SELECT @myRight := rgt FROM categories
WHERE category_id = '$category_id';
UPDATE categories SET rgt = rgt + 2 WHERE rgt > @myRight;
UPDATE categories SET lft = lft + 2 WHERE lft > @myRight;
INSERT INTO categories(name, lft, rgt, parent) VALUES($cat_name, @myRight + 1, @myRight + 2, $category_id);
UNLOCK TABLES";
//echo $enter_category;
$category_query = mysql_query($enter_category);
menu_case(2);
}