Php - mysql question?

Mittul Chuahan

New member
m working in php and mysql

hello .. i have two tables named "members" and "articlelist"

in my "members" table i have
--------------------------------------...
id - as auto increment (int)
username - varchar
fullname - varchar
--------------------------------------...

and in my "articlelist" i have
--------------------------------------...
id- as autoincrement (int)
userid - int (will be inserted the same id which is in "members" table during new article upload)
articletitle - varchar
--------------------------------------...


the user can log in and upload as many articles as they want ..


now i want to fetch the "fullname" from the "members" table according to the "userid" from the "articlelist" table.

the "userid" in the articlelist can be at multiple times as the user can upload as many articles as he wants.

but i dont know the query how to do it as i tried a lot..


m doing this query but its not working .. ..

--------------------------------------...
$userid = /* set to the user id of user who logged in */

$query = " select a.userid, m.username, m.fullname, a.articletitle " .
" from members m " .
" join articlelist a " .
" on a.userid = m.id " .
" where m.id = $userid ";
--------------------------------------...

but we are fetching the first value only .. instead we are able to fetch only the first record in the members table with its "fullname" .. but we want to fetch the multiple fullname as per the articles uploaded .. we are stuck .. we dont know how to do this .. please help us ..

please help us how to do this ..
 
Back
Top