cronoszeu Posted January 25, 2010 Share Posted January 25, 2010 Hello there, As my first post I can say i`m a noon in php.. I need some help with one code and I don`t know how to make it. The problem it is I want to display some infos from DB but there it`s a trick table 1: - accounts id, account_name and online tavle 2: - users name, account_id well what I want it is to display on a page the Names that are online but I need to link somehow(I don`t know) so the script search the online accounts and after link to users and display it .. If any one can help me will be verry nice. Regards Link to comment https://forums.phpfreaks.com/topic/189744-help-with-a-db-selection/ Share on other sites More sharing options...
Adam Posted January 25, 2010 Share Posted January 25, 2010 Assuming "online" is a bool value, this SQL would do the job: select a.*, u.* from accounts a, users u where a.id = u.account_id and a.online = 1 Link to comment https://forums.phpfreaks.com/topic/189744-help-with-a-db-selection/#findComment-1001360 Share on other sites More sharing options...
cronoszeu Posted January 25, 2010 Author Share Posted January 25, 2010 Thanks for reply but I made a mystake in description .. The problem it is that are 2 separated DB`s accounts DB and users DB in a.db I have table accounts (id,name,online) where online its 1 or 0 in u.db I havet table users (name, account_id) *names from acc and user are not same So can you please tweek your query to work for this ? Regards and thanks again Link to comment https://forums.phpfreaks.com/topic/189744-help-with-a-db-selection/#findComment-1001401 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.