- Автор темы
- #1
I found the solution, now need help with mysql
This function registers an account
but you need to also recorded in this table account's id to a string DBAccount_id
DBGameAccount
table structure:
you help?
<<< SELECT id FROM DBAccount WHERE id = '$id'
<<< INSERT INTO DBGameAccount (DBAccount_id) values ('$id')
id take
and write it in the db column
how to implement?
Код:
function addAccount($email, $finalSalt, $finalV, $userLevel) {
include('dbconfig.php');
$email=mysql_real_escape_string($email);
$finalV = addslashes($finalV);
$err = mysql_query("INSERT INTO DBAccount (email,salt,passwordVerifier,userLevel) values ('$email','$finalSalt','".$finalV."','0') ") or die(mysql_error());
if( $err )
return true;
else return false;
}
but you need to also recorded in this table account's id to a string DBAccount_id
DBGameAccount
table structure:
Код:
/*
MySQL Data Transfer
Source Host: 195.191.126.44
Source Database: d3login
Target Host: 195.191.126.44
Target Database: d3login
Date: 08.08.2012 1:24:58
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for DBAccount
-- ----------------------------
CREATE TABLE `DBAccount` (
`Id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`Email` varchar(255) DEFAULT NULL,
`Salt` tinyblob,
`PasswordVerifier` blob,
`BattleTagName` varchar(255) DEFAULT NULL,
`HashCode` int(11) DEFAULT NULL,
`UserLevel` varchar(255) DEFAULT NULL,
`LastOnline` bigint(20) DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Table structure for DBActiveSkills
-- ----------------------------
CREATE TABLE `DBActiveSkills` (
`Id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`Rune0` int(11) DEFAULT NULL,
`Skill0` int(11) DEFAULT NULL,
`Rune1` int(11) DEFAULT NULL,
`Skill1` int(11) DEFAULT NULL,
`Rune2` int(11) DEFAULT NULL,
`Skill2` int(11) DEFAULT NULL,
`Rune3` int(11) DEFAULT NULL,
`Skill3` int(11) DEFAULT NULL,
`Rune4` int(11) DEFAULT NULL,
`Skill4` int(11) DEFAULT NULL,
`Rune5` int(11) DEFAULT NULL,
`Skill5` int(11) DEFAULT NULL,
`Passive0` int(11) DEFAULT NULL,
`Passive1` int(11) DEFAULT NULL,
`Passive2` int(11) DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- ----------------------------
-- Table structure for DBGameAccount
-- ----------------------------
CREATE TABLE `DBGameAccount` (
`Id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`Banner` blob,
`LastOnline` bigint(20) DEFAULT NULL,
`Gold` int(11) DEFAULT NULL,
`StashSize` int(11) DEFAULT NULL,
`DBAccount_id` bigint(20) unsigned DEFAULT NULL,
`LastPlayedHero_id` bigint(20) unsigned DEFAULT NULL,
PRIMARY KEY (`Id`),
KEY `DBAccount_id` (`DBAccount_id`),
KEY `LastPlayedHero_id` (`LastPlayedHero_id`),
KEY `DBAccount_id_2` (`DBAccount_id`),
KEY `LastPlayedHero_id_2` (`LastPlayedHero_id`),
CONSTRAINT `FK6BE1E67D17DD8A68` FOREIGN KEY (`DBAccount_id`) REFERENCES `DBAccount` (`Id`),
CONSTRAINT `FK6BE1E67D58A58F13` FOREIGN KEY (`LastPlayedHero_id`) REFERENCES `DBToon` (`Id`),
CONSTRAINT `FKB0F23B044D29D1B8` FOREIGN KEY (`DBAccount_id`) REFERENCES `DBAccount` (`Id`),
CONSTRAINT `FKB0F23B0482377C5E` FOREIGN KEY (`LastPlayedHero_id`) REFERENCES `DBToon` (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Table structure for DBInventory
-- ----------------------------
CREATE TABLE `DBInventory` (
`Id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`EquipmentSlot` int(11) DEFAULT NULL,
`LocationX` int(11) DEFAULT NULL,
`LocationY` int(11) DEFAULT NULL,
`DBGameAccount_id` bigint(20) unsigned DEFAULT NULL,
`DBToon_id` bigint(20) unsigned DEFAULT NULL,
`DBItemInstance_id` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`Id`),
KEY `DBGameAccount_id` (`DBGameAccount_id`),
KEY `DBToon_id` (`DBToon_id`),
KEY `DBItemInstance_id` (`DBItemInstance_id`),
KEY `DBGameAccount_id_2` (`DBGameAccount_id`),
KEY `DBToon_id_2` (`DBToon_id`),
KEY `DBItemInstance_id_2` (`DBItemInstance_id`),
CONSTRAINT `FK143822B851C3A8FA` FOREIGN KEY (`DBToon_id`) REFERENCES `DBToon` (`Id`),
CONSTRAINT `FK143822B8A5E99DE2` FOREIGN KEY (`DBItemInstance_id`) REFERENCES `DBItemInstance` (`Id`),
CONSTRAINT `FK143822B8A69A76BF` FOREIGN KEY (`DBGameAccount_id`) REFERENCES `DBGameAccount` (`Id`),
CONSTRAINT `FK86B0DE7E4C0425AC` FOREIGN KEY (`DBGameAccount_id`) REFERENCES `DBGameAccount` (`Id`),
CONSTRAINT `FK86B0DE7EA98CAE9E` FOREIGN KEY (`DBItemInstance_id`) REFERENCES `DBItemInstance` (`Id`),
CONSTRAINT `FK86B0DE7EC0ADA6C6` FOREIGN KEY (`DBToon_id`) REFERENCES `DBToon` (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- ----------------------------
-- Table structure for DBItemInstance
-- ----------------------------
CREATE TABLE `DBItemInstance` (
`Id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`GbId` int(11) DEFAULT NULL,
`Affixes` varchar(255) DEFAULT NULL,
`Attributes` varchar(255) DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- ----------------------------
-- Table structure for DBToon
-- ----------------------------
CREATE TABLE `DBToon` (
`Id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`Class` varchar(255) DEFAULT NULL,
`Deleted` tinyint(1) DEFAULT NULL,
`Experience` int(11) DEFAULT NULL,
`Flags` varchar(255) DEFAULT NULL,
`Level` tinyint(3) unsigned DEFAULT NULL,
`Name` varchar(255) DEFAULT NULL,
`TimePlayed` int(10) unsigned DEFAULT NULL,
`DBGameAccount_id` bigint(20) unsigned DEFAULT NULL,
PRIMARY KEY (`Id`),
KEY `DBGameAccount_id` (`DBGameAccount_id`),
KEY `DBGameAccount_id_2` (`DBGameAccount_id`),
CONSTRAINT `FK77D377384C0425AC` FOREIGN KEY (`DBGameAccount_id`) REFERENCES `DBGameAccount` (`Id`),
CONSTRAINT `FKF8752C35A69A76BF` FOREIGN KEY (`DBGameAccount_id`) REFERENCES `DBGameAccount` (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- ----------------------------
-- Table structure for FriendsToFriends
-- ----------------------------
CREATE TABLE `FriendsToFriends` (
`AccountAId` bigint(20) unsigned NOT NULL,
`AccountBId` bigint(20) unsigned NOT NULL,
KEY `AccountBId` (`AccountBId`),
KEY `AccountAId` (`AccountAId`),
KEY `AccountBId_2` (`AccountBId`),
KEY `AccountAId_2` (`AccountAId`),
CONSTRAINT `FK626D5D1451455CB3` FOREIGN KEY (`AccountBId`) REFERENCES `DBAccount` (`Id`),
CONSTRAINT `FK626D5D14DDE05CB3` FOREIGN KEY (`AccountAId`) REFERENCES `DBAccount` (`Id`),
CONSTRAINT `FK9474B4A516CC8AEC` FOREIGN KEY (`AccountAId`) REFERENCES `DBAccount` (`Id`),
CONSTRAINT `FK9474B4A516CC8EB3` FOREIGN KEY (`AccountBId`) REFERENCES `DBAccount` (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
<<< SELECT id FROM DBAccount WHERE id = '$id'
<<< INSERT INTO DBGameAccount (DBAccount_id) values ('$id')
id take
and write it in the db column
how to implement?