cdoggg94 Posted December 7, 2011 Share Posted December 7, 2011 I think that I am in way over my head here... What I want is a connection to a bunch of tables at once. (eg: name1_tbl, name2_tbl name3_tbl...etc....) I want to get those names without the "_tbl" from a different table that displays them like this: name1, name2, name3...etc. I THINK i want the end output to be something like this: <?php $name1 = mysql_query = ('SELECT* FROM name1_tbl ORDER BY user_id DESC'); $name2 = mysql_query = ('SELECT* FROM name2_tbl ORDER BY user_id DESC'); $name3 = mysql_query = ('SELECT* FROM name3_tbl ORDER BY user_id DESC'); // for how ever many there are ?> i just dont know how to get to that point, and dont want to add them manually when a new person and table is added.. I dont know if this makes any sense...if anyone could help it would be much appreciated.. Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted December 7, 2011 Share Posted December 7, 2011 why are you making a table for each person? Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted December 7, 2011 Share Posted December 7, 2011 That indicates poor database design. There is no reason to create a new table for each new person/user. Quote Link to comment Share on other sites More sharing options...
cdoggg94 Posted December 7, 2011 Author Share Posted December 7, 2011 I want to display one one page, side by side, certain things from each user. So like.. <table width="159" border="0"> <tr> <td colspan="3" >Name</td> </tr> <tr> <th >Website</th> <th >Priority</th> <th >Status</th> </tr> <tr> <td > </td> <td > </td> <td > </td> </tr> </table> My issue with all users being in the same table is that I want the table above to repeat for each user... In my head creating a table for each user when the user was created was a good way to do that. Quote Link to comment Share on other sites More sharing options...
cdoggg94 Posted December 7, 2011 Author Share Posted December 7, 2011 each table was going to be displayed like this is the username from the log in == ""name1"{ display the content from name1_tbl } and repeat.. Quote Link to comment Share on other sites More sharing options...
cdoggg94 Posted December 7, 2011 Author Share Posted December 7, 2011 if the username from the log_tbl in == "name1"{ display the content from name1_tbl } and repeat.. Quote Link to comment Share on other sites More sharing options...
cdoggg94 Posted December 7, 2011 Author Share Posted December 7, 2011 sorry my typing right now is horrible.. if the username from the login_tbl == "name1"{ display the content from name1_tbl } and repeat.. Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted December 7, 2011 Share Posted December 7, 2011 create 2 tables, one for the users, and one for each website. The users table would have a user id and info about each user and a unique id. The website table would have a unique website id and who owns it along with the status and priority. something like this: <?php $sql = mysql_query("select * from users u left join websites w on(u.userid = w.userid)"); $users = array(); while($row = mysql_fetch_assoc($sql)){ $users[$row['userid']][] = $row; } print_r($users); ?> Quote Link to comment Share on other sites More sharing options...
cdoggg94 Posted December 7, 2011 Author Share Posted December 7, 2011 Alright...I am going to try something like that... I think your right, I was making it wayyyy more complicated then it needed to be.... Thanks a lot for the help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.