Jump to content

error in my sql coding


dekon

Recommended Posts

i keep having a error with my code saying the following Error. Please try again laterColumn count doesn't match value count at row 1 
could someone help me solve this :)

 

<?php  
include 'header.php';
include 'mysql.php';  
echo '<h3>Create Catergory</h3>';
if($_SERVER['REQUEST_METHOD'] != 'POST')  
{  
    //the form hasn't been posted yet, display it  
    echo '<form method="post" action="">  
           Catergory Name: <input type="text" name="name" /></p>  
           Catergory Description: <input type="textarea" name="description"></p>   
            <input type="submit" value="Add Catergory" />  
         </form>'; 
} 
else 
{ 
    //the form has been posted, so save it 
	 $sql = "INSERT INTO 
                    catagories(name, description) 
                VALUES('" . mysql_real_escape_string($_POST['name']) . "', 				
                       '" . mysql_real_escape_string($_POST['description']) . "', 
                        NOW(),   0)";  
        $result = mysql_query($sql);  
        if(!$result)  
        {  
            echo 'Error. Please try again later';//. mysql_error(); 
			exit();
        } 
        else 
        { 
            echo 'New category successfully added.'; 
			exit();
        } 
} 
include 'footer.php';
?>  

 

 

Link to comment
https://forums.phpfreaks.com/topic/275745-error-in-my-sql-coding/
Share on other sites

The error is pretty straight forward. You are trying to insert 4 values into 2 columns.

 

darkfreaks: If you can answer the question at hand please do, otherwise, leave the thread to people who can. We really don't need every thread around here having you highlight deprecations. Like your security scanning replies, it's going to get pretty old pretty quick.

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.