soy nuevo y me gustaria aprender mucho de este gran foro.
Quisiera ayuda para hacer una pagina para poder leer y editar los datos de dos tablas diferentes de mi base de datos
Tengo dos tablas y quiero juntar los datos por medio de php
es la base de datos de un juego en linea MMORPG
Mi primer tabla que quiero usar es cq_user y la segundo cq_bonus
la tabla cq_user es la siguiente
Cita:
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for cq_user
-- ----------------------------
DROP TABLE IF EXISTS `cq_user`;
CREATE TABLE `cq_user` (
`name` varchar(15) binary NOT NULL default '',
`mate` varchar(15) binary NOT NULL default 'None',
`lookface` int(4) unsigned NOT NULL default '0',
`hair` smallint(2) unsigned NOT NULL default '0',
`money` int(4) unsigned NOT NULL default '0',
`money_saved` int(4) unsigned NOT NULL default '0',
`coin_money` int(3) unsigned NOT NULL default '0',
`level` tinyint(1) unsigned NOT NULL default '1',
`exp` bigint(4) NOT NULL default '0',
`strength` smallint(2) unsigned NOT NULL default '0',
`old_prof` tinyint(2) unsigned NOT NULL default '0',
`Speed` smallint(2) unsigned NOT NULL default '0',
`health` smallint(2) unsigned NOT NULL default '0',
`soul` smallint(2) unsigned NOT NULL default '0',
`additional_point` smallint(2) unsigned NOT NULL default '0',
`auto_allot` tinyint(1) unsigned NOT NULL default '1',
`life` smallint(2) unsigned NOT NULL default '0',
`mana` smallint(2) unsigned NOT NULL default '0',
`profession` tinyint(2) unsigned NOT NULL default '0',
`deed` int(4) NOT NULL default '0',
`pk` smallint(2) NOT NULL default '0',
`nobility` tinyint(1) unsigned NOT NULL default '0',
`medal` int(4) unsigned NOT NULL default '0',
`medal_select` int(4) unsigned NOT NULL default '0',
`metempsychosis` tinyint(1) unsigned NOT NULL default '0',
`syndicate_id` int(4) unsigned NOT NULL default '0',
`recordmap_id` int(4) unsigned NOT NULL default '0',
`recordx` smallint(2) unsigned NOT NULL default '0',
`recordy` smallint(2) unsigned NOT NULL default '0',
`account_id` int(4) unsigned NOT NULL default '0',
`id` int(4) unsigned NOT NULL auto_increment,
`last_login` int(8) unsigned NOT NULL default '0',
`account` varchar(15) binary NOT NULL default 'ÎÞ',
`password` varchar(15) binary NOT NULL default 'ÎÞ',
`task_mask` int(4) unsigned zerofill NOT NULL default '0000',
`time_of_life` int(4) unsigned zerofill NOT NULL default '0000',
`virtue` int(4) unsigned zerofill NOT NULL default '0000',
`home_id` int(4) unsigned zerofill NOT NULL default '0000',
`lock_key` int(10) unsigned NOT NULL default '0',
`emoney` int(4) unsigned NOT NULL default '0',
`chk_sum` int(4) unsigned NOT NULL default '0',
`god_status` int(4) unsigned NOT NULL default '0',
`exp_ball_usage` smallint(2) unsigned NOT NULL default '0',
`online_time` int(4) unsigned NOT NULL default '0',
`auto_exercise` tinyint(2) unsigned NOT NULL default '0',
`last_logout` int(4) unsigned NOT NULL default '0',
`big_prize_fails` int(4) unsigned NOT NULL default '0',
`small_prize_fails` int(4) unsigned NOT NULL default '0',
`mete_lev` int(4) NOT NULL default '0',
`current_layout_type` tinyint(1) NOT NULL default '0',
`flower` int(4) unsigned NOT NULL default '0',
`online_time2` tinyint(4) unsigned NOT NULL default '0',
`offline_time` tinyint(4) unsigned NOT NULL default '0',
`last_logout2` int(4) unsigned NOT NULL default '0',
`donation` bigint(20) unsigned NOT NULL default '0',
`business` int(4) unsigned NOT NULL default '0',
`flower_r` int(4) unsigned NOT NULL default '0',
`flower_w` int(4) unsigned NOT NULL default '0',
`flower_lily` int(4) unsigned NOT NULL default '0',
`flower_tulip` int(4) unsigned NOT NULL default '0',
`first_prof` tinyint(2) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `index_name` (`name`),
KEY `index_account` (`account_id`),
KEY `index_money` (`money_saved`),
KEY `index_pk` (`pk`),
KEY `index_level` (`level`,`profession`),
KEY `tim` (`last_login`),
KEY `index_profession` (`profession`),
KEY `idx_mate` (`mate`)
) TYPE=MyISAM;
-- ----------------------------
-- Table structure for cq_user
-- ----------------------------
DROP TABLE IF EXISTS `cq_user`;
CREATE TABLE `cq_user` (
`name` varchar(15) binary NOT NULL default '',
`mate` varchar(15) binary NOT NULL default 'None',
`lookface` int(4) unsigned NOT NULL default '0',
`hair` smallint(2) unsigned NOT NULL default '0',
`money` int(4) unsigned NOT NULL default '0',
`money_saved` int(4) unsigned NOT NULL default '0',
`coin_money` int(3) unsigned NOT NULL default '0',
`level` tinyint(1) unsigned NOT NULL default '1',
`exp` bigint(4) NOT NULL default '0',
`strength` smallint(2) unsigned NOT NULL default '0',
`old_prof` tinyint(2) unsigned NOT NULL default '0',
`Speed` smallint(2) unsigned NOT NULL default '0',
`health` smallint(2) unsigned NOT NULL default '0',
`soul` smallint(2) unsigned NOT NULL default '0',
`additional_point` smallint(2) unsigned NOT NULL default '0',
`auto_allot` tinyint(1) unsigned NOT NULL default '1',
`life` smallint(2) unsigned NOT NULL default '0',
`mana` smallint(2) unsigned NOT NULL default '0',
`profession` tinyint(2) unsigned NOT NULL default '0',
`deed` int(4) NOT NULL default '0',
`pk` smallint(2) NOT NULL default '0',
`nobility` tinyint(1) unsigned NOT NULL default '0',
`medal` int(4) unsigned NOT NULL default '0',
`medal_select` int(4) unsigned NOT NULL default '0',
`metempsychosis` tinyint(1) unsigned NOT NULL default '0',
`syndicate_id` int(4) unsigned NOT NULL default '0',
`recordmap_id` int(4) unsigned NOT NULL default '0',
`recordx` smallint(2) unsigned NOT NULL default '0',
`recordy` smallint(2) unsigned NOT NULL default '0',
`account_id` int(4) unsigned NOT NULL default '0',
`id` int(4) unsigned NOT NULL auto_increment,
`last_login` int(8) unsigned NOT NULL default '0',
`account` varchar(15) binary NOT NULL default 'ÎÞ',
`password` varchar(15) binary NOT NULL default 'ÎÞ',
`task_mask` int(4) unsigned zerofill NOT NULL default '0000',
`time_of_life` int(4) unsigned zerofill NOT NULL default '0000',
`virtue` int(4) unsigned zerofill NOT NULL default '0000',
`home_id` int(4) unsigned zerofill NOT NULL default '0000',
`lock_key` int(10) unsigned NOT NULL default '0',
`emoney` int(4) unsigned NOT NULL default '0',
`chk_sum` int(4) unsigned NOT NULL default '0',
`god_status` int(4) unsigned NOT NULL default '0',
`exp_ball_usage` smallint(2) unsigned NOT NULL default '0',
`online_time` int(4) unsigned NOT NULL default '0',
`auto_exercise` tinyint(2) unsigned NOT NULL default '0',
`last_logout` int(4) unsigned NOT NULL default '0',
`big_prize_fails` int(4) unsigned NOT NULL default '0',
`small_prize_fails` int(4) unsigned NOT NULL default '0',
`mete_lev` int(4) NOT NULL default '0',
`current_layout_type` tinyint(1) NOT NULL default '0',
`flower` int(4) unsigned NOT NULL default '0',
`online_time2` tinyint(4) unsigned NOT NULL default '0',
`offline_time` tinyint(4) unsigned NOT NULL default '0',
`last_logout2` int(4) unsigned NOT NULL default '0',
`donation` bigint(20) unsigned NOT NULL default '0',
`business` int(4) unsigned NOT NULL default '0',
`flower_r` int(4) unsigned NOT NULL default '0',
`flower_w` int(4) unsigned NOT NULL default '0',
`flower_lily` int(4) unsigned NOT NULL default '0',
`flower_tulip` int(4) unsigned NOT NULL default '0',
`first_prof` tinyint(2) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `index_name` (`name`),
KEY `index_account` (`account_id`),
KEY `index_money` (`money_saved`),
KEY `index_pk` (`pk`),
KEY `index_level` (`level`,`profession`),
KEY `tim` (`last_login`),
KEY `index_profession` (`profession`),
KEY `idx_mate` (`mate`)
) TYPE=MyISAM;
y cq_bonus es la siguiente
Cita:
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for cq_bonus
-- ----------------------------
DROP TABLE IF EXISTS `cq_bonus`;
CREATE TABLE `cq_bonus` (
`action` int(4) unsigned zerofill NOT NULL default '0000',
`id` int(4) unsigned zerofill NOT NULL auto_increment,
`id_account` int(4) unsigned zerofill NOT NULL default '0000',
`flag` tinyint(3) unsigned NOT NULL default '0',
`ref_id` int(4) unsigned NOT NULL default '0',
`time` int(4) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `account_id` (`id_account`)
) TYPE=MyISAM;
-- ----------------------------
-- Table structure for cq_bonus
-- ----------------------------
DROP TABLE IF EXISTS `cq_bonus`;
CREATE TABLE `cq_bonus` (
`action` int(4) unsigned zerofill NOT NULL default '0000',
`id` int(4) unsigned zerofill NOT NULL auto_increment,
`id_account` int(4) unsigned zerofill NOT NULL default '0000',
`flag` tinyint(3) unsigned NOT NULL default '0',
`ref_id` int(4) unsigned NOT NULL default '0',
`time` int(4) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `account_id` (`id_account`)
) TYPE=MyISAM;
En la tabla cq_bonus tiene valores de la tabla cq_user
lo que quiero hacer es que poner un boton de buscar para que busque el nombre del personaje en cq_user y muestre todo lo que tenga relacionado con cq_bonus y poder editarlo, asi como tambien poder agregar valores del mismo php y guardarlos a la base de datos