开发者

PHP & SELECT how to?

I want to show what the user($pusername) have been posted, in member_film, me开发者_如何学Gomber_meetups, member_tutorials.. And then if e.g the user have 2 columns with his username, i want to display the "navn" from the same column. Same with title on member_tutorials, and meetup on member_meetups.

An example on how i want it to look like:

Your posts: (which as i want, checks the three table if there's any columns with the user's username in "username" column.)

My new video, its so good (navn, which is from member_film)

My boring meetup with my parents (title, which is from member_meetup)

My great great video!(navn, which is from member_film)


I'm going to guess what your question is. And this is procedural style, not OOP.

// Make sure you've connected to the db
$pusername = mysqli_real_escape_string($pusername);
$query = mysqli_query($CONNECTION,"SELECT * FROM `database`.`member_film` WHERE `user` = '{$pusername}'");
$results = mysqli_fetch_assoc($query);
print_r($results);

Try that, fiddle with it, and it should start to make sense.


If you create a view, it's possible you could do this. A view is basically an imaginery table that's built out of another query.

http://dev.mysql.com/doc/refman/5.0/en/create-view.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜