I am building a simple forum...and have a problem...
I have two tables (in MySQL) tlike this:
forumtopics (
topic_id int(10) NOT NULL auto_increment,
topic_title varchar(100),
topic_poster int(10),
topic_time varchar(20),
topic_views int(10) DEFAULT '0' NOT NULL,
forum_id int(10),
topic_status int(10) DEFAULT '0' NOT NULL,
topic_notify int(2) DEFAULT '0',
PRIMARY KEY (topic_id)
);
users (
user_id int(11) NOT NULL auto_increment,
name varchar(60) DEFAULT '' NOT NULL,
uname varchar(25) DEFAULT '' NOT NULL,
email varchar(60) DEFAULT '' NOT NULL,
url varchar(100) DEFAULT '' NOT NULL,
user_picture varchar(30),
user_regdate varchar(20) DEFAULT '' NOT NULL,
user_icq varchar(15),
user_gg varchar(15),
user_from varchar(100),
user_intrest varchar(150),
user_sig varchar(255),
user_viewemail tinyint(2),
pass varchar(40) DEFAULT '' NOT NULL,
umode varchar(10) DEFAULT '' NOT NULL,
counter int(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (user_id)
);
I want to select the username of user that created a topic:
$result = mysql_query("SELECT t.*, u.uname FROM forumtopics t, users u WHERE t.topic_poster = u.user_id ORDER BY topic_time DESC");
$myrow = mysql_fetch_array($result);
.
.
.
(and here)
$username = mysql_query("SELECT uname FROM users WHERE user_id = 'myrow[topic_poster]'");
I got only sth like this:
Resource id #4
Resource id #6
Resource id #8
Resource id #10
Resource id #12
What do I do wrong or.. how to do it that it work...
THX A LOT