dekon Posted March 16, 2013 Share Posted March 16, 2013 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'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/275745-error-in-my-sql-coding/ Share on other sites More sharing options...
darkfreaks Posted March 17, 2013 Share Posted March 17, 2013 MYSQL_REAL_ESCAPE_STRING This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQL extension should be used. Quote Link to comment https://forums.phpfreaks.com/topic/275745-error-in-my-sql-coding/#findComment-1419091 Share on other sites More sharing options...
Solution trq Posted March 17, 2013 Solution Share Posted March 17, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/275745-error-in-my-sql-coding/#findComment-1419098 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.