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 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 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 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 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')"; 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 Column count doesn't match value count at row 1in query I got this error if I take that out 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 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 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 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
Archived
This topic is now archived and is closed to further replies.