PDA

View Full Version : MySQL Database Error


BigJohnson
06-19-2002, 09:46 PM
Database error in vBulletin Control Panel 2.2.5:

Invalid SQL: INSERT INTO user (userid,usergroupid,username,password,email,stylei d,parentemail,coppauser,homepage,icq,aim,yahoo,sig nature,adminemail,receivebulletin,receivebulletin_ type,showemail,invisible,usertitle,customtitle,joi ndate,cookieuser,daysprune,lastvisit,lastactivity, lastpost,posts,storep,timezoneoffset,emailnotifica tion,receivepm,emailonpm,ipaddress,pmpopup,options ,birthday) VALUES (NULL,'9','Guest','adb831a7fdd83dd1e2a309ce7591dff 8','.com','1','None@none.com','0','http://.com','None','None','None','I am a Guest','0','0','0','0','Geust','1',1024525836,'0', '-1',1024525836,1024525836,1024525836,'0','0','0','0 ','0','0','','0','0','1986/10/13')
mysql error: Column count doesn't match value count at row 1

mysql error number: 1136

Date: Wednesday 19th of June 2002 06:30:36 PM
Script: /messageboard/admin/user.php
Referer: /messageboard/admin/user.php?action=add


I tried making a new user in the Admin section and this is what i got when i filled the info and i click send. What is wrong?

BigJohnson
06-20-2002, 01:19 AM
I need this feature back fast because I always create peoples accounts through the admin cp and after a couple of hacks i think this happened. I dont no which hacks it could be because install like 50 so i cannot go back tracking through to see what is wrong. If you need my user.php file i will send it to you please help. Thanks so much. I need it badly. Thanks so much again.

Steve Machol
06-20-2002, 01:24 AM
You will be violating the licence agreement if you distribute user.php or any vB file. My suggestion is to reupload the original user.php file and see if that fixes the problem. If it does, then at least you'll know where the problem is.

It's also possible that your host upgrade PHP to 4.2.0/4.2.1 which also causes a problem similar to this. If that's the case, the only fix is to either upgrade to 2.2.6 or apply the tached files in freddie's post here:

http://www.vbulletin.com/forum/showthread.php?s=&threadid=44820

BigJohnson
06-20-2002, 02:08 AM
This did not work. I cant upload the original USER.php file because i have installed so many hacks and i no that file has been edited. There has to be something else i can do to fix this. The mySQL error up top doesn't explain anything to you guys like what happened or what went wrong? and my php version is 4.1.0 and was never upgraded. Someone Please help me out.

BigJohnson
06-20-2002, 02:56 AM
I cant just add the new file because i need the upgrades i did for it. I will post pictures of the scripts instead in my PHP programer if that would work instead of actually posting the txt of the code if that is illegal. I really need all the stuff installed. I will do anything. I will take pictures of my database so you can see. What ever you need. PLease help me out.

FWC
06-20-2002, 05:46 AM
You are missing a value in the second line between 'I am a Guest' and 'Geust'. You have five values in the first line between signature and title and only 4 values in the line below.

BigJohnson
06-20-2002, 01:26 PM
I see now. That makes. Sense. I am going to post some pics to see if this helps because i still don't know how to fix the problem. I would really like to send someone the user.php file for someone to look at. Is it breaking the rules even if the other person has a license and I do and you all know we have a license? Can i take pictures of the php script and post them here? Is that still considered against the license because I really need this fixed bad. This is the main part of the admin section to edit peoples stuff. Please help. I am going to post pics of my admin section where you add a user here are the pics. I don't know if this helps at all but i am trying to tell you all the info you want

http://www.heavenz-cypher.com/bgadmin1.gif

http://www.heavenz-cypher.com/bgadmin2.gif

http://www.heavenz-cypher.com/bgadmin3.gif

BigJohnson
06-20-2002, 01:50 PM
Now here are some pictures of my database. If you need specific lines from the user.php file just ask. Thanks so much. You guys are all great for helping out.

http://www.heavenz-cypher.com/bgdatabase1.GIF
http://www.heavenz-cypher.com/bgdatabase2.GIF
http://www.heavenz-cypher.com/bgdatabase3.GIF
http://www.heavenz-cypher.com/bgdatabase4.GIF

BigJohnson
06-20-2002, 06:26 PM
HEre is some code i think that might help. This is a part of the code in the user.php

Please help me out.

// ###################### Start add #######################
if ($action=="add") {

echo "Add New User";

doformheader("user","insert");
maketableheader("User Profile");
makechoosercode("User Group","usergroupid","usergroup",2);
makeinputcode("User Name","ausername");
makeinputcode("Password","apassword");
makeinputcode("Email Address","email");
makeinputcode("User Title","usertitle");
makeyesnocode("Use Custom Title<br><font size='1'>(This forces the title that you put in the field above to be used)</font>","customtitle",0);
makestylecode("Style set","userstyleid",$user[styleid]);
makeinputcode("Home Page","homepage","http://www.");
makeinputcode("Birthday<br>(Format yyyy-mm-dd)","birthday");
// Country Hack CP Addon by Stasik (modded by AJ)
echo "<tr class='".getrowbg()."'><td>Country Flag</td><td nowrap>";
eval("\$countrytext.= \"".gettemplate("modifyprofile_country")."\";");
echo "$countrytext</td></tr>";
// Country Hack CP Addon End
maketextareacode("Signature","signature","",8,45);
makeinputcode("ICQ Number","icq");
makeinputcode("AIM Handle","aim");
makeinputcode("Yahoo Messenger Handle","yahoo");
makeyesnocode("COPPA user","coppauser",0);
makeinputcode("Parent Email Address","parentemail");
maketableheader("Options");
makeyesnocode("Receive mailings from admins","adminemail",1);
makeyesnocode("Receive Community Bulletin Email","receivebulletin",1);
makeyesnocode("Receive Community Bulletin Email Type (Yes = HTML, No = Text)","receivebulletin_type",1);
makeyesnocode("Show email address","showemail",1);
makeyesnocode("Invisible on 'Online users' list","invisible",0);
makeyesnocode("Receive PMs","receivepm",1);
makeyesnocode("Email on PM","emailonpm",0);
makeyesnocode("PM Popup","pmpopup",0);
makeyesnocode("Show Signatures","showsignatures",1);
makeyesnocode("Show Avatars","showavatars",1);
makeyesnocode("Show Images","showimages",1);
makeyesnocode("Show VBcode","showvbcode",1);
makeyesnocode("Use email notification by default","emailnotification",1);
makeyesnocode("Remember Username and password","cookieuser",1);
makeyesnocode("Browse boards with cookies","nosessionhash",1);
makeinputcode("Join Date<br>(Format yyyy-mm-dd, leave blank for today)","joindate");
makeinputcode("Default view age<br>'Select threads from last x days'<br>Recommended values: 1, 2, 5, 10, 20, 30, 45, 60, 75, 100, 365, 1000 (ie all). -1 gives default forum selection","daysprune","-1");
makeinputcode("Last Visit<br>(Format yyyy-mm-dd hh:mm:ss, leave blank for today)","lastvisit");
makeinputcode("Last Activity<br>(Format yyyy-mm-dd hh:mm:ss, leave blank for today)","lastactivity");
makeinputcode("Last Post<br>(Format yyyy-mm-dd hh:mm:ss, leave blank for today)","lastpost");
makeinputcode("Number of Posts","posts","0");
makeinputcode("Number of Points","storep","0");
makeinputcode("Time Zone Offset (hours)","timezoneoffset","0");
makeinputcode("IP Address","aipaddress",$ipaddress);
maketableheader("Custom Profile Fields");
$profilefields=$DB_site->query("SELECT profilefieldid,title FROM profilefield");
while ($profilefield=$DB_site->fetch_array($profilefields)) {
makeinputcode($profilefield[title],"field".$profilefield[profilefieldid]);
}

doformfooter("Save");
}

// ###################### Start insert #######################
if ($HTTP_POST_VARS['action']=="insert") {

if (!isset($ausername) or $ausername == '') {
echo "<p>You did not give this user an username</p>";
exit;
}

if ($exists=$DB_site->query_first("SELECT userid FROM user WHERE username='".addslashes(htmlspecialchars($ausername))."'")) {
echo "There is already an ".makelinkcode('user',"user.php?do=edit&userid=$exists[userid]",1)." named <b>".htmlspecialchars($ausername)."</b>";
exit;
}

if (!isset($apassword) or $apassword == '') {
echo "You did not give this user a password";
exit;
}

if ($joindate=="") {
$joindate=time();
} else {
$joindate="UNIX_TIMESTAMP('".addslashes($joindate)."')";
}
if ($lastvisit=="") {
$lastvisit=time();
} else {
$lastvisit="UNIX_TIMESTAMP('".addslashes($lastvisit)."')";
}
if ($lastactivity=="") {
$lastactivity=time();
} else {
$lastactivity="UNIX_TIMESTAMP('".addslashes($lastactivity)."')";
}
if ($lastpost=="") {
$lastpost=time();
} else {
$lastpost="UNIX_TIMESTAMP('".addslashes($lastpost)."')";
}
if ($biography=="Location:\r\nOccupation:\r\nInterests:\r\n") {
$biography="";
}

/* remove because it did not like 0000 as year-J $temp = explode("-", $birthday);
if ((!checkdate($temp[1],$temp[2],$temp[0]))||(!ereg("^[0-9]{4}\-[0-9]{2}\-[0-9]{2}$",$birthday)))
$birthday = 0; */

$options=iif($showsignatures==1,SHOWSIGNATURES,0);
$options+=iif($showavatars==1,SHOWAVATARS,0);
$options+=iif($showimages==1,SHOWIMAGES,0);
$options+=iif($showvbcode==1,SHOWVBCODE,0);

$DB_site->query("INSERT INTO user (userid,usergroupid,username,password,email,stylei d,parentemail,coppauser,homepage,icq,aim,yahoo,sig nature,adminemail,receivebulletin,receivebulletin_ type,showemail,invisible,usertitle,customtitle,joi ndate,cookieuser,daysprune,lastvisit,lastactivity, lastpost,posts,storep,timezoneoffset,emailnotifica tion,receivepm,emailonpm,ipaddress,pmpopup,options ,birthday) VALUES (NULL,'$usergroupid','".addslashes(htmlspecialchars($ausername))."','".addslashes(md5($apassword))."','".addslashes(htmlspecialchars($email))."','$userstyleid','".addslashes(htmlspecialchars($parentemail))."','$coppauser','".addslashes(htmlspecialchars($homepage))."','".addslashes(htmlspecialchars($icq))."','".addslashes(htmlspecialchars($aim))."','".addslashes(htmlspecialchars($yahoo))."','".addslashes($signature)."','$adminemail','$receivebulletin','$showemail','$ invisible','".addslashes($usertitle)."','$customtitle',$joindate,'$cookieuser','$dayspru ne',$lastvisit,$lastactivity,$lastpost,'$posts','$ storep','$timezoneoffset','$emailnotification','$r eceivepm','$emailonpm','".addslashes($aipaddress)."','$pmpopup','$options','$birthday')");
$userid=$DB_site->insert_id();

$userfields="";
$userfieldsnames="(userid";
$profilefields=$DB_site->query("SELECT maxlength,profilefieldid,title
FROM profilefield
ORDER BY displayorder");
while ($profilefield=$DB_site->fetch_array($profilefields)) {
$varname="field$profilefield[profilefieldid]";
$userfieldsnames.=",field$profilefield[profilefieldid]";
$userfields.=",'".addslashes(htmlspecialchars($$varname))."'";
}
$userfieldsnames.=')';

$DB_site->query("INSERT INTO userfield $userfieldsnames VALUES ($userid$userfields)");

$action="modify";

echo "<p>Record added</p>";

}

BigJohnson
06-20-2002, 11:50 PM
can someone please help me i need this very quick. I don't no how to fix this error.

BigJohnson
06-21-2002, 12:11 AM
I think i might be missing recieve bulletin board type. How will still look into this. If anyone finds out please post the correct code. At least we are getting some where hehe. Big Thanks to FWC

BigJohnson
06-21-2002, 12:44 AM
No mroe need for the help. I fixed it myself. It was an error in the txt for the community bulletin thing. The instructions are wrong and they are still wrong when i looked at it but i fixed it. Thanks for you help FWC you really helped me out.

FWC
06-21-2002, 04:52 AM
Originally posted by BigJohnson
Thanks for you help FWC you really helped me out. Glad to help. :)

Boofo
07-01-2002, 09:10 PM
FWC, I think we ought to change your title to "Ultimate Helper" instead of "Ultimate Hacker". You always seem to be around to lend a helping hand to those of us that need it. :)

FWC
07-02-2002, 04:22 AM
Originally posted by Boofo
FWC, I think we ought to change your title to "Ultimate Helper" instead of "Ultimate Hacker". You always seem to be around to lend a helping hand to those of us that need it. :) LOL, I've just seen a lot of problems in the past year and remember how to fix most of them. Firefly is the "Ultimate Helper". :)

Boofo
07-03-2002, 07:48 AM
Ok, then we'll just dub you "Ultimate Helper's Assistant", how's that? :)

Originally posted by FWC
LOL, I've just seen a lot of problems in the past year and remember how to fix most of them. Firefly is the "Ultimate Helper". :)