Jump to content

[SOLVED] Mysql error, i think?


mike12255

Recommended Posts

So im running a query and after it gets pased this line:

 

$res6 = mysql_query($sql6) or die (mysql_error());

 

it gives the following error:

 

Table 'fourm.forum_subcats' doesn't exist

 

The long line of code that the peice is in is:

 

 <?php

if ($act == "create_subcat") {
				if (!$_POST['submit']){
					echo "<table border=\"0\" cellspacing=\"3\" cellpadding=\"3\">\n";
                        echo "<form method = \"post\" action = \"admin.php?act=create_subcat\">\n";
                        echo "<tr><td>Forum Catagory</td><td><select name=\"cat\"><option value=\"0\">Please Choose...</option>";
                        $sql5 = "SELECT * FROM forum_cats ORDER BY id ASC";
                        $res5 = mysql_query($sql5) or die (mysql_error());
                        if (mysql_num_rows($res5) == 0){
                        	echo "</select><br><br>There are no catagories yet.";
                        	
                        }else{
                        	while ($row5 = mysql_fetch_assoc($res5)){
                        		echo "<option value=\"".$row5['id']."\">".$row5['name']."</option>";
                        		
                        	}
                        	
                        }
					echo "</select></td></tr>";
					echo "<tr><td>Sub Cat. Name</td><td><input type =\"text\" name=\"name\"></td></tr> ";
					echo "<tr><td>Description</td><td><input type =\"textarea\" name=\"desc\" style =\"width:300px;height:60px;\"></td></tr>";
					echo "<tr><td colspan =\"2\" align=\"right\"><input type=\"submit\" name= \" submit\" value = \"Add Forum Sub Cat.\"></td></tr>";
					echo "</form></table>";

				}else{

					$cat = mss($_POST['cat']);
					$name = mss($_POST['name']);
					$desc = mss($_POST['desc']);


					if ($cat && $name){

						$sql6 = "SELECT * FROM forum_cats WHERE id ='".$cat."'";


						$res6 = mysql_query($sql6) or die (mysql_error());

					if (mysql_num_rows($res6)== 0){
						die("est");
						echo "<br>Please Select a Main Catagory.";
					}else{
						$sql7 = "SELECT * FROM forum_subcats WHERE name = '".$name."' AND cid ='".$cat."'";
						$res7 = mysql_query($sql7) or die (mysql_error());
						if (mysql_num_rows($res7) > 0){

							echo "This sub catagory already exsists in the main catagory'".$cat."'";
						}else{
						if(strlen($desc)>255){
							echo"Description must be under 255 characters.";
						}else{
							$row7 = (mysql_fetch_assoc($res6));

							$sql8 ="INSERT INTO forum_subcats (cid,name,desc,admin)VALUES ('".$cat."','".$name."', '".$desc."', '".$row7['admin']."')";
							$res8 = mysql_query($sql8) or die (mysql_error());
							echo "The subcatagory <b>".$name."</b> has been sucsesfully created.";



						}?>

Did i screw up one of my queries?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.