Utilizing info from 2 tables in the database
| From: | Brad R. C. | Date: | Thu, 26 Jul 2001 21:42:43 +0000 |
| Subject: | Utilizing info from 2 tables in the database | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-59834@lists.php.net to get a copy of this message | ||
Lets say I have created 2 tables :
create table comments {contents}
userid
username
comment
datetime
user
ip
primary key
key
table users {contents}
userid
username
.... and many more.. :)
----------
if I want to get that to work togther to add comments to users would I have
something like this..
--
$user=$DB_site->query_first("SELECT *,FROM username,
FROM user
LEFT JOIN comments ON
comments.userid=user.userid
WHERE user.userid=$userid");
--
that above code is slapped toghther.. can anyone shed some light on this..