Taku Posted January 18, 2013 Share Posted January 18, 2013 anyone got an idea why my first column always got a value of 0 and its value is placed on the next column Quote Link to comment https://forums.phpfreaks.com/topic/273324-first-column-is-always-0-in-the-table/ Share on other sites More sharing options...
gristoi Posted January 18, 2013 Share Posted January 18, 2013 nope I have no idea, try helping us to help you by posting your code. How can you expect people to help you with such a generic question Quote Link to comment https://forums.phpfreaks.com/topic/273324-first-column-is-always-0-in-the-table/#findComment-1406732 Share on other sites More sharing options...
Taku Posted January 18, 2013 Author Share Posted January 18, 2013 (edited) if(isset($_POST['Input'])) { $cl = mysql_real_escape_string($_POST['clt']); $c = mysql_real_escape_string($_POST['ct']); $cb = mysql_real_escape_string($_POST['cbt']); $cc = mysql_real_escape_string($_POST['cct']); if(!$cl OR !$c OR !$cb OR !$cc) { echo '<script type="text/javascript">alert("Please fill up the form")</script>'; require "custodian_man.php"; } else { $SQL = "INSERT INTO f_beg (Cafe_Latte, Chocolate, Creme_Brulee, Cookies_Cream) VALUES( '','$cl','$c','$cb','$cc')"; echo("Success"); $result = mysql_query($SQL) or die('error'.mysql_error().'in query'.$SQL); } } here it is sorry `.` it is working fine but in the table the 1st value is always placed in the 2nd column making the last value to be gone Edited January 18, 2013 by Taku Quote Link to comment https://forums.phpfreaks.com/topic/273324-first-column-is-always-0-in-the-table/#findComment-1406733 Share on other sites More sharing options...
gristoi Posted January 18, 2013 Share Posted January 18, 2013 youve got an extra field in your insert: VALUES( '','$cl','$c','$cb','$cc')"; should be VALUES( '$cl','$c','$cb','$cc')"; Quote Link to comment https://forums.phpfreaks.com/topic/273324-first-column-is-always-0-in-the-table/#findComment-1406734 Share on other sites More sharing options...
Taku Posted January 18, 2013 Author Share Posted January 18, 2013 (edited) Column count doesn't match value count at row 1in query I got this error if I take that out Edited January 18, 2013 by Taku Quote Link to comment https://forums.phpfreaks.com/topic/273324-first-column-is-always-0-in-the-table/#findComment-1406736 Share on other sites More sharing options...
gristoi Posted January 18, 2013 Share Posted January 18, 2013 (edited) Im going to hazzard a guess that the first column in your table is an id column? but not set to auto incriment, post the table struture Edited January 18, 2013 by gristoi Quote Link to comment https://forums.phpfreaks.com/topic/273324-first-column-is-always-0-in-the-table/#findComment-1406737 Share on other sites More sharing options...
Taku Posted January 18, 2013 Author Share Posted January 18, 2013 oh nvm dude it seems I forgot a comma in my original program tnx for the idea it helps Quote Link to comment https://forums.phpfreaks.com/topic/273324-first-column-is-always-0-in-the-table/#findComment-1406738 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.