abdfahim Posted August 21, 2006 Share Posted August 21, 2006 I am not sure whether it is possible what I m wanting to do. I have two table "tableA" and "tableB". Now I want 2 things ..1) "columnA1" of "tableA" automatically contains same value as "columnB1" of "tableB". If I change/add anything in "columnB1" of "tableB", it will automatically changed/added in "columnA1" of "tableA".2)I want "columnA2" of "tableA" = Sum of ("columnB2" of "tableB") all time. "columnB2" is a integer field.So plz help me. I m very much starter in mysql. Quote Link to comment Share on other sites More sharing options...
fenway Posted August 21, 2006 Share Posted August 21, 2006 The only way to actually do this is using triggers (MySQL 5), but I'm not sure why you want to do this. Quote Link to comment Share on other sites More sharing options...
abdfahim Posted August 22, 2006 Author Share Posted August 22, 2006 That is because I want to show the website summery (like total user, online user, post ... etc) on the 1st page of my website. To do this I have to access different database and tables which i afraid may coz delay in loading the page. So what I want is to create an extra table and put the necessary field related to original tables so that I can get all the info by accessing one single table. Quote Link to comment Share on other sites More sharing options...
fenway Posted August 22, 2006 Share Posted August 22, 2006 This different database is where? Quote Link to comment Share on other sites More sharing options...
abdfahim Posted August 23, 2006 Author Share Posted August 23, 2006 Ok, the whole situation is -I have 4 database "userdb","forumdb","newsdb","profiledb". [b]All databases are in the same server[/b], i.e. I have to connect once and then just switch database by the command "mysql_select_db()". All databases has seperate tables. Now I am afraid that switching databases 10/11 times in one page may increase the loading time of the page. So I create an extra table on "newsdb" database and trying to link this table with other table. The reason is given in my prev reply. Quote Link to comment Share on other sites More sharing options...
fenway Posted August 23, 2006 Share Posted August 23, 2006 Why connect/disconnect multiple times per page? Connect once, then keep both connections opened for the duration of the script. There shouldn't be any noticable slowdown. 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.