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
https://forums.phpfreaks.com/topic/162100-solved-mysql-error-i-think/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.