MyBB Community Forums

Full Version: Adding queries to the member.php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi. Tell me which line of code I have to insert this query?
$query = $db->query("INSERT INTO `users_list` (`char_name`,`char_gid`) VALUES ('$username','{$mybb->user['uid']}')");
Because when I put in a 250-line form to me in the blank records. ;/

Sorry for my language mistakes, but I'm Polish. Toungue
(2013-11-07, 07:33 AM)Mezir95 Wrote: [ -> ]Hi. Tell me which line of code I have to insert this query?
$query = $db->query("INSERT INTO `users_list` (`char_name`,`char_gid`) VALUES ('$username','{$mybb->user['uid']}')");
Because when I put in a 250-line form to me in the blank records. ;/

Sorry for my language mistakes, but I'm Polish. Toungue

can you rephrase the question ?
(2013-11-07, 08:05 PM)JimR Wrote: [ -> ]
(2013-11-07, 07:33 AM)Mezir95 Wrote: [ -> ]Hi. Tell me which line of code I have to insert this query?
$query = $db->query("INSERT INTO `users_list` (`char_name`,`char_gid`) VALUES ('$username','{$mybb->user['uid']}')");
Because when I put in a 250-line form to me in the blank records. ;/

Sorry for my language mistakes, but I'm Polish. Toungue

can you rephrase the question ?


I think he said, can you tell me where do I insert this query?
He meant that - he attempt to insert his code at line 250 within member.php file,
and it 'does not work as intended' and asking where he should insert it to make it work
.

@Mezir95
You should NOT do it this way.
Core edits are not recommended and should be avoided as possible.

Practicaly almost everything can be done by plugin/hooks system without touching core files,
therefore i strongly recommend, that you should take a fiew moments to check documentation,
or browse fiew online tutorials about creating myBB plugins, and insert your queries from there.

Look at 'helloworld' plugin, to get idea how this system works, copy it and add your hook with stuff.

Useful links

Creating myBB plugin - http://docs.mybb.com/Authoring_Plugins-B..._Step.html
Hooks system - http://docs.mybb.com/Plugins-The_Hook_System.html
List of myBB hooks - http://docs.mybb.com/MyBB_Plugin_Hooks.html
A somebody will create me plugin? Smile
(2013-11-08, 06:53 AM)Mezir95 Wrote: [ -> ]A somebody will create me plugin? Smile

what are you trying to do ???
the table 'user_list' is not a standard mybb table, if this is a table you have produced can you tell us what the structure of the table is ?

if you have not produced the table can you tell us what the table structure should be ?

where do you want to display the data that is stored in this table and what other uses does this data have?

do users need to be able to edit this data ? If so where would you like the fields to be edited (e.g usercp) ?
Plugin has to save data only to additional table when registration. Smile
(2013-11-08, 09:24 PM)Mezir95 Wrote: [ -> ]Plugin has to save data only to additional table when registration. Smile

so what is the structure of the table ??? it will be difficult to save data to a table that the coder does not know what it's structure is
Please. That an additional table.
CREATE TABLE IF NOT EXISTS `players` (
  `char_uid` int(11) NOT NULL AUTO_INCREMENT,
  `char_gid` int(11) NOT NULL,
  `char_name` varchar(24) NOT NULL,
  `char_hours` mediumint(6) NOT NULL DEFAULT '0',
  `char_minutes` tinyint(2) NOT NULL DEFAULT '0',
  `char_skin` smallint(3) NOT NULL,
  `char_health` float NOT NULL DEFAULT '100',
  `char_sex` tinyint(1) NOT NULL,
  `char_birth` mediumint(4) NOT NULL,
  `char_cash` mediumint(6) NOT NULL DEFAULT '500',
  `char_bankcash` mediumint(6) NOT NULL DEFAULT '0',
  `char_banknumb` int(9) NOT NULL DEFAULT '0',
  `char_warns` tinyint(1) NOT NULL DEFAULT '0',
  `char_int` mediumint(6) NOT NULL,
  `char_vw` mediumint(6) NOT NULL,
  `char_bw` mediumint(6) NOT NULL,
  `char_aj` mediumint(6) NOT NULL DEFAULT '0',
  `char_crash` tinyint(1) NOT NULL DEFAULT '0',
  `char_block` tinyint(1) NOT NULL DEFAULT '0',
  `char_posx` float NOT NULL,
  `char_posy` float NOT NULL,
  `char_posz` float NOT NULL,
  `char_hoteluid` int(11) NOT NULL,
  `char_pdp` tinyint(2) NOT NULL DEFAULT '0',
  `char_bizuid` int(11) NOT NULL DEFAULT '0',
  `char_bizperm` smallint(3) NOT NULL DEFAULT '0',
  `char_biztitle` varchar(32) NOT NULL DEFAULT 'Brak',
  `char_bizpayment` smallint(3) NOT NULL DEFAULT '0',
  `char_bizskin` smallint(3) NOT NULL DEFAULT '0',
  `char_orguid` int(11) NOT NULL DEFAULT '0',
  `char_orgperm` smallint(3) NOT NULL DEFAULT '0',
  `char_orgtitle` varchar(32) NOT NULL DEFAULT 'Brak',
  `char_orgpayment` smallint(3) NOT NULL DEFAULT '0',
  `char_orgskin` smallint(3) NOT NULL DEFAULT '0',
  `char_facuid` int(11) NOT NULL DEFAULT '0',
  `char_facperm` smallint(3) NOT NULL DEFAULT '0',
  `char_factitle` varchar(32) NOT NULL DEFAULT 'Brak',
  `char_facpayment` smallint(3) NOT NULL DEFAULT '0',
  `char_facskin` smallint(3) NOT NULL DEFAULT '0',
  `char_documents` smallint(3) NOT NULL DEFAULT '0',
  `char_driving` float NOT NULL DEFAULT '0',
  `char_swimming` float NOT NULL DEFAULT '0',
  `char_shooting` float NOT NULL DEFAULT '0',
  `char_fishing` float NOT NULL DEFAULT '0',
  `char_strength` float NOT NULL DEFAULT '0',
  `char_dependence` float NOT NULL DEFAULT '0',
  `char_lastpay` mediumint(6) NOT NULL DEFAULT '0',
  `char_job` tinyint(1) NOT NULL DEFAULT '0',
  `char_arrest` tinyint(1) NOT NULL DEFAULT '0',
  `char_arresttime` mediumint(6) NOT NULL DEFAULT '0',
  `char_spawnplace` tinyint(1) NOT NULL DEFAULT '6',
  `char_house` int(11) NOT NULL DEFAULT '0',
  `char_fightstyle` tinyint(2) NOT NULL DEFAULT '4',
  `char_missionsperday` int(11) NOT NULL DEFAULT '0',
  `char_online` tinyint(1) NOT NULL DEFAULT '0',
  `char_textopis` text CHARACTER SET utf8 COLLATE utf8_polish_ci NOT NULL,
  PRIMARY KEY (`char_uid`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2084 ;

Forum UID to char_gid
Forum nickname to char_name
(2013-11-09, 08:10 AM)Mezir95 Wrote: [ -> ]Please. That an additional table.
CREATE TABLE IF NOT EXISTS `players` (
  `char_uid` int(11) NOT NULL AUTO_INCREMENT,
  `char_gid` int(11) NOT NULL,
  `char_name` varchar(24) NOT NULL,
  `char_hours` mediumint(6) NOT NULL DEFAULT '0',
  `char_minutes` tinyint(2) NOT NULL DEFAULT '0',
  `char_skin` smallint(3) NOT NULL,
  `char_health` float NOT NULL DEFAULT '100',
  `char_sex` tinyint(1) NOT NULL,
  `char_birth` mediumint(4) NOT NULL,
  `char_cash` mediumint(6) NOT NULL DEFAULT '500',
  `char_bankcash` mediumint(6) NOT NULL DEFAULT '0',
  `char_banknumb` int(9) NOT NULL DEFAULT '0',
  `char_warns` tinyint(1) NOT NULL DEFAULT '0',
  `char_int` mediumint(6) NOT NULL,
  `char_vw` mediumint(6) NOT NULL,
  `char_bw` mediumint(6) NOT NULL,
  `char_aj` mediumint(6) NOT NULL DEFAULT '0',
  `char_crash` tinyint(1) NOT NULL DEFAULT '0',
  `char_block` tinyint(1) NOT NULL DEFAULT '0',
  `char_posx` float NOT NULL,
  `char_posy` float NOT NULL,
  `char_posz` float NOT NULL,
  `char_hoteluid` int(11) NOT NULL,
  `char_pdp` tinyint(2) NOT NULL DEFAULT '0',
  `char_bizuid` int(11) NOT NULL DEFAULT '0',
  `char_bizperm` smallint(3) NOT NULL DEFAULT '0',
  `char_biztitle` varchar(32) NOT NULL DEFAULT 'Brak',
  `char_bizpayment` smallint(3) NOT NULL DEFAULT '0',
  `char_bizskin` smallint(3) NOT NULL DEFAULT '0',
  `char_orguid` int(11) NOT NULL DEFAULT '0',
  `char_orgperm` smallint(3) NOT NULL DEFAULT '0',
  `char_orgtitle` varchar(32) NOT NULL DEFAULT 'Brak',
  `char_orgpayment` smallint(3) NOT NULL DEFAULT '0',
  `char_orgskin` smallint(3) NOT NULL DEFAULT '0',
  `char_facuid` int(11) NOT NULL DEFAULT '0',
  `char_facperm` smallint(3) NOT NULL DEFAULT '0',
  `char_factitle` varchar(32) NOT NULL DEFAULT 'Brak',
  `char_facpayment` smallint(3) NOT NULL DEFAULT '0',
  `char_facskin` smallint(3) NOT NULL DEFAULT '0',
  `char_documents` smallint(3) NOT NULL DEFAULT '0',
  `char_driving` float NOT NULL DEFAULT '0',
  `char_swimming` float NOT NULL DEFAULT '0',
  `char_shooting` float NOT NULL DEFAULT '0',
  `char_fishing` float NOT NULL DEFAULT '0',
  `char_strength` float NOT NULL DEFAULT '0',
  `char_dependence` float NOT NULL DEFAULT '0',
  `char_lastpay` mediumint(6) NOT NULL DEFAULT '0',
  `char_job` tinyint(1) NOT NULL DEFAULT '0',
  `char_arrest` tinyint(1) NOT NULL DEFAULT '0',
  `char_arresttime` mediumint(6) NOT NULL DEFAULT '0',
  `char_spawnplace` tinyint(1) NOT NULL DEFAULT '6',
  `char_house` int(11) NOT NULL DEFAULT '0',
  `char_fightstyle` tinyint(2) NOT NULL DEFAULT '4',
  `char_missionsperday` int(11) NOT NULL DEFAULT '0',
  `char_online` tinyint(1) NOT NULL DEFAULT '0',
  `char_textopis` text CHARACTER SET utf8 COLLATE utf8_polish_ci NOT NULL,
  PRIMARY KEY (`char_uid`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2084 ;

Forum UID to char_gid
Forum nickname to char_name

does (or is) the table prefixed the same way as the forum tables ?
Pages: 1 2