Im looking to change the UID that I grab from the table to the username. My problem is that the Username is only in one of the two tables. while the UID is in both.
When I grab this table for info I would like to get the username as well to replace the uid.
CREATE TABLE mo_chars (
cid int(14) NOT NULL auto_increment,
uid int(14) default NULL,
gid int(2) NOT NULL default '1',
lid int(8) NOT NULL default '1',
hid int(4) NOT NULL default '1',
color int(8) NOT NULL default '50',
site int(14) NOT NULL default '20',
size int(14) NOT NULL default '0',
PRIMARY KEY (cid)
)
This table holds the username.
CREATE TABLE mo_users (
uid int(14) NOT NULL auto_increment,
username varchar(24) NOT NULL default '',
email varchar(128) default NULL,
password tinytext,
birthdate date NOT NULL default '0000-00-00',
active enum('0','1') NOT NULL default '0',
date_join datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (uid)
)
I know I need to use joins but after reading Mysql Joins I just got more confused.