modern-day-pirate Posted May 13, 2008 Share Posted May 13, 2008 okay, so ive been working on this PHP MMO for a while now, but whenever i try to register a new player, or add a news post, or post in the forum i get this message: Incorrect integer value: '' for column 'id' at row 1 any ideas? Quote Link to comment Share on other sites More sharing options...
Psycho Posted May 13, 2008 Share Posted May 13, 2008 Um, use a correct integer value? Seriously though, you will need to post some code for us to be of any help. Most likely your query is screwed up. You should create your query as a variable so you can echo it to the page for debugging purposes. Quote Link to comment Share on other sites More sharing options...
peranha Posted May 13, 2008 Share Posted May 13, 2008 I believe it is saying that you are not inserting an integer into an integer field in the database Quote Link to comment Share on other sites More sharing options...
modern-day-pirate Posted May 13, 2008 Author Share Posted May 13, 2008 ok here's the bit of code for adding a new news post: function addnews() { if (isset($_POST["submit"])) { extract($_POST); $errors = 0; $errorlist = ""; if ($content == "") { $errors++; $errorlist .= "Content is required.<br />"; } if ($errors == 0) { $query = doquery("INSERT INTO {{table}} SET id='',postdate=NOW(),content='$content'", "news"); admindisplay("News post added.","Add News"); } else { admindisplay("<b>Errors:</b><br /><div style=\"color:red;\">$errorlist</div><br />Please go back and try again.", "Add News"); } } Quote Link to comment Share on other sites More sharing options...
peranha Posted May 13, 2008 Share Posted May 13, 2008 you are setting id to nothing, it needs to have an integer in it. Quote Link to comment Share on other sites More sharing options...
modern-day-pirate Posted May 13, 2008 Author Share Posted May 13, 2008 right....lol but how can i set it to a value of one highr than the highest value in the table? Quote Link to comment Share on other sites More sharing options...
peranha Posted May 13, 2008 Share Posted May 13, 2008 in your table, set the autoincrement for column id Quote Link to comment Share on other sites More sharing options...
modern-day-pirate Posted May 13, 2008 Author Share Posted May 13, 2008 it's already set to auto_increment. thats why i dont understand Quote Link to comment Share on other sites More sharing options...
peranha Posted May 13, 2008 Share Posted May 13, 2008 $query = doquery("INSERT INTO {{table}} postdate=NOW(),content='$content'", "news"); Than that will work, just dont mention it in the query. Quote Link to comment Share on other sites More sharing options...
modern-day-pirate Posted May 13, 2008 Author Share Posted May 13, 2008 IT WORKED! thank you. Quote Link to comment 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.