php - MySQL Error: Column count doesn't match value count at row 1 - Radipanel -
i using panel unfamiliar with; friends , can't seem resolve issue. i've looked missing commas , values might not add can't seem see solution.
i keep getting error: mysql error: column count doesn't match value count @ row 1 thought i'd see if internet samaritan lend hand.
any appreciated!
<?php if( !preg_match( "/index.php/i", $_server['php_self'] ) ) { die(); } if( $_get['id'] ) { $id = $core->clean( $_get['id'] ); $query = $db->query( "select * users id = '{$id}'" ); $data = $db->assoc( $query ); $data['ugroups'] = explode( ",", $data['usergroups'] ); $editid = $data['id']; } ?> <?php $query = $db->query("select * users username = '{$username}'"); $array = $db->assoc($query); if ($user->data['id'] == "{$editid}") { $db->query( "insert logs values (null, 'attempted edit own account <font color=\"ff0000\"><b>denied</b></font>', null, '<b>{$user->data['fullusername']}</b> ({$_server['remote_addr']})', '1') " ); die("<div class=\"square bad\"> <strong>error</strong><br> cant not edit own account! log inserted!</div>"); } ?> <form action="" method="post" id="adduser"> <div class="box"> <div class="square title"> <strong>edit user</strong> </div> <?php if( $_post['submit'] ) { try { $username = $core->clean( $_post['username'] ); $password = $core->clean( $_post['password'] ); $email = $core->clean( $_post['email'] ); $habbo = $core->clean( $_post['habbo'] ); $dgroup = $core->clean( $_post['dgroup'] ); $banned = $core->clean( $_post['banned'] ); $jobtitle = $core->clean( $_post['jobtitle'] ); $forumuser = $core->clean( $_post['forumuser'] ); $skypeuser = $core->clean( $_post['skypeuser'] ); $notes = $core->clean( $_post['notes'] ); $query = $db->query( "select * usergroups" ); while( $array = $db->assoc( $query ) ) { if( $_post['ugroup-' . $array['id']] ) { $ugroups .= $array['id'] . ","; } } $password_enc = $core->encrypt( $password ); if( !$username or ( !$password , !$editid ) or !$dgroup or !$ugroups ) { throw new exception( "all fields required." ); } else { if( $editid ) { if( $password ) { $password = ", password = '{$password_enc}'"; } else { unset( $password ); } $db->query( "update users set username = '{$username}', password = '{$password}', email = '{$email}', habbo = '{$habbo}', displaygroup = '{$dgroup}', usergroups = '{$ugroups}', banned = '{$banned}', jobtitle = '{$jobtitle}', forumuser = '{$forumuser}', skypeuser = '{$skypeuser}', notes = '{$notes}', id = '{$editid}'" ); } else { $db->query( "insert users values (null, '{$username}', '{$password_enc}', '{$email}', '{$habbo}', '{$dgroup}', '{$ugroups}', '{$banned}', '{$jobtitle}', '{$forumuser}', '{$skypeuser}', '{$notes}');" ); } echo "<div class=\"square good\">"; echo "<strong>success</strong>"; echo "<br />"; echo "user added!"; echo "</div>"; $db->query( "insert logs values (null, 'edited user $username <font color=\"51c833\"><b>success</b></font>', null, '<b>{$user->data['fullusername']}</b> ({$_server['remote_addr']})', '1') " ); } } catch( exception $e ) { echo "<div class=\"square bad\">"; echo "<strong>error</strong>"; echo "<br />"; echo $e->getmessage(); echo "</div>"; $db->query( "insert logs values (null, 'edited user $username <font color=\"ff0000\"><b>fail</b></font>', null, '<b>{$user->data['fullusername']}</b> ({$_server['remote_addr']})', '1') " ); } } ?> <table width="100%" cellpadding="3" cellspacing="0"> <?php if ($data['banned'] == "1") { ?> <div style="background: red; border: 1px solid black; padding: 5px;"><strong>user banned!</strong></div> <?php } // user management display group if ($user->data['displaygroup'] == "4") { $db->query( "insert logs values (null, 'edit user, wrong perms <font color=\"ff0000\"><b>denied</b></font>', null, '<b>{$user->data['fullusername']}</b> ({$_server['remote_addr']})', '1') " ); die("<div class=\"square bad\"> <strong>error</strong><br> have incorrect display group, please contact administrator assistance</div>"); } // radio management display group else if ($user->data['displaygroup'] == "39") { $query = $db->query( "select * usergroups mgmt = '1'" ); } // forum events management display group else if ($user->data['displaygroup'] == "52") { $query = $db->query( "select * usergroups mgmt = '1'" ); } // events management display group else if ($user->data['displaygroup'] == "41") { $query = $db->query( "select * usergroups mgmt = '1'" ); } // news management display group else if ($user->data['displaygroup'] == "40") { $query = $db->query( "select * usergroups mgmt = '1'" ); } // community manager display group else if ($user->data['displaygroup'] == "38") { $query = $db->query( "select * usergroups mgmt = '1'" ); } // administrator display group else if ($user->data['displaygroup'] == "31") { $query = $db->query( "select * usergroups admin = '1'" ); } // panel administrator display group else if ($user->data['displaygroup'] == "32") { $query = $db->query( "select * usergroups snradmin = '1'" ); } // developer display group else if ($user->data['displaygroup'] == "42") { $query = $db->query( "select * usergroups mgmt = '1'" ); } // owner display group else if ($user->data['displaygroup'] == "5") { $query = $db->query( "select * usergroups" ); } else { // random code hide page else die("<div class=\"square bad\"> <strong>error</strong><br> sorry not have correct permission view page! contact admin!</div>"); } while( $array = $db->assoc( $query ) ) { if( in_array( $array['id'], $data['ugroups'] ) ) { $groups[$array['id'] . '_active'] = $array['name']; } else { $groups[$array['id']] = $array['name']; } if( $array['id'] == $data['displaygroup'] ) { $dgroups[$array['id'] . '_active'] = $array['name']; } else { $dgroups[$array['id']] = $array['name']; } } $opt_banned = array ( "0" => "active", "1" => "banned" ); echo $core->buildfield( "text", "required", "username", "username", "the new username.", $data['username'] ); echo $core->buildfield( "password", "<?php if( !$editid ) { ?>required<?php } ?>", "password", "password", "" ); echo $core->buildfield( "text", "", "email", "email", "the new email (optional).", $data['email'] ); echo $core->buildfield( "text", "", "habbo", "habbo name", "staff members habbo name", $data['habbo'] ); echo $core->buildfield( "text", "", "jobtitle", "job title", "the staff members job title", $data['jobtitle'] ); echo $core->buildfield( "text", "", "forumuser", "forum username", "the staff members forum username", $data['forumuser'] ); echo $core->buildfield( "text", "", "skypeuser", "skype username", "the staff members skype useranme", $data['skypeuser'] ); echo $core->buildfield( "left_textarea", "", "notes", "acc notes", "the staff members notes", $data['notes'] ); echo $core->buildfield( "select", "", "banned", "banned", "to ban user, enter 1, restricting them logging in or 0 not ban.", $opt_banned ); echo $core->buildfield( "select", "required", "dgroup", "display group", "the user's display group.", $dgroups ); echo $core->buildfield( "checkbox", "required", "ugroup", "active usergroups", "the user's active groups.", $groups ); ?> </table> </div> <div class="box" align="right"> <input class="button" type="submit" name="submit" value="submit" /> </div> </form> <?php echo $core->buildformjs('adduser'); ?>
you didn't post table structure, simply: number of values doesn't match number of columns in table 'logs'.
Comments
Post a Comment