0o0o0 Posted January 13, 2016 Share Posted January 13, 2016 Two questions.. I have two tables.. one plumbing, one flooring. To see the list on a browser I created php and html.. all good. one for plumbing one for flooring. now today I want to COMBINE the two on one page.. so I did... but to the viewer they see a list and cannot tell whether a line is plumbing or flooring unless they read the details. I would like the ending to state PLUMBING, or to state FLOORING.. for quick reference. So the two questions.. how does one make a column in their table lets call it "Jobtype" to always add the word "PLUMBING " when an entry is inputted.. ( kind of like how timestamp stamps the time without any manual input) second question maybe easier than messing with my tables. If you had such setup like ive explained how would you php program to post PLUMBING if the line came from plumbing table, and post FLOORING if the next 2 lines were from flooring, and the next 4 lines say ( any number ) to post PLUMBING ... other than simply having $jobtype, if the tables werent done like question one. todays been pretty hazy so I came to the forums for a little brain wake up Quote Link to comment https://forums.phpfreaks.com/topic/300310-making-a-db-autofill-a-column-with-a-topic/ Share on other sites More sharing options...
Barand Posted January 13, 2016 Share Posted January 13, 2016 I need to know a couple of things before I can give you an answer. How are you outputting them to the page (the code)? What are the structures of those two tables? Quote Link to comment https://forums.phpfreaks.com/topic/300310-making-a-db-autofill-a-column-with-a-topic/#findComment-1529598 Share on other sites More sharing options...
0o0o0 Posted January 19, 2016 Author Share Posted January 19, 2016 (edited) Lets do this another way.. say you have 3 identically structured tables.. except ones for plumbing, ones for electrical ones for say carpentry now eventually you want to create another table called. ALL So you would dump table 1 (plumbing) table 2 (electrical) table 3 (carpentry) into ALL... by cron at the end of everyday in the future.. You would have a table with all the tables info, except no real understanding of which row is plumbing, electrical or carpentry.So .. what i trying to find on the net, which I havent found yet.. is every time I put an entry into plumbing.. i do the usual.. but is there a way to create something like what TIMESTAMP row does.. but its just the word "PLUMBING" automatically in a row.. when I hit save. In that table forever.. same for adding an entry into electrical, the last row ( I will add to all tables when I find out if this is capable) the last row will automatically enter ELECTRICAL. get me? I know I sound LAAAAAZY.. lol but eventually adding the word "plumbing" to the last row in plumbing table every single time.. tedious.So.. now down the road, I dump all 3 tables into ALL table.. and I can then grab all plumbing when needed or all electrical, or plumbing and electrical without carpentry etc etc.. Or am im outdated? and theres a way to dump tables and insert which table they came from in the process of dumping the three tables into the "ALL" table. ( im not using "ALL" as a table name, its just for explanation here) Even if I wanted to just spit out the entire all 3 databases on an webpage as it stands now.... they COULD say plumbing , electrical, carpentry on them.. but it still wouldnt have it in the last row in the tables. Edited January 19, 2016 by 0o0o0 Quote Link to comment https://forums.phpfreaks.com/topic/300310-making-a-db-autofill-a-column-with-a-topic/#findComment-1530086 Share on other sites More sharing options...
0o0o0 Posted January 19, 2016 Author Share Posted January 19, 2016 lol can I just go into my plumbing table, and add a row.. that always inputs PLUMBING in that last row automatically. simply put, without all the yammer lol.... is it possible? Quote Link to comment https://forums.phpfreaks.com/topic/300310-making-a-db-autofill-a-column-with-a-topic/#findComment-1530087 Share on other sites More sharing options...
mac_gyver Posted January 19, 2016 Share Posted January 19, 2016 first of all, you are asking about a value in a column, not a row. how does one make a column in their table lets call it "Jobtype" to always add the word "PLUMBING " when an entry is inputted.. the answer is to add some programming logic to the code that's INSERTing the data. they call this stuff software for a reason. if it doesn't do what you want, you can change it to suit your needs. you should actually have a jobtype table that defines the different jobtype names and assigns a jobtype_id to each one. it's the jobtype_id that should be stored in the jobtype column. you should not be regularly dumping this data into a combined database table. you should do this once for the existing data, then use the single combined database table from that point forward. Quote Link to comment https://forums.phpfreaks.com/topic/300310-making-a-db-autofill-a-column-with-a-topic/#findComment-1530089 Share on other sites More sharing options...
0o0o0 Posted January 20, 2016 Author Share Posted January 20, 2016 An Organized approach! thankyou. Quote Link to comment https://forums.phpfreaks.com/topic/300310-making-a-db-autofill-a-column-with-a-topic/#findComment-1530091 Share on other sites More sharing options...
Muddy_Funster Posted January 22, 2016 Share Posted January 22, 2016 Lets do this another way.. say you have 3 identically structured tables.. except ones for plumbing, ones for electrical ones for say carpentry now eventually you want to create another table called. ALL So you would dump table 1 (plumbing) table 2 (electrical) table 3 (carpentry) into ALL... by cron at the end of everyday in the future.. **NO I Wouldn't, not at the end of the day, not to the same server, not ever.** You would have a table with all the tables info, except no real understanding of which row is plumbing, electrical or carpentry. **That's in complete contradiction to the operating paradigm of a relational database system** So .. what i trying to find on the net, which I havent found yet.. is every time I put an entry into plumbing.. i do the usual.. but is there a way to create something like what TIMESTAMP row does.. but its just the word "PLUMBING" automatically in a row.. when I hit save. In that table forever.. same for adding an entry into electrical, the last row ( I will add to all tables when I find out if this is capable) the last row will automatically enter ELECTRICAL. get me? I know I sound LAAAAAZY.. lol but eventually adding the word "plumbing" to the last row in plumbing table every single time.. tedious. So.. now down the road, I dump all 3 tables into ALL table.. and I can then grab all plumbing when needed or all electrical, or plumbing and electrical without carpentry etc etc.. Or am im outdated? and theres a way to dump tables and insert which table they came from in the process of dumping the three tables into the "ALL" table. ( im not using "ALL" as a table name, its just for explanation here) Even if I wanted to just spit out the entire all 3 databases on an webpage as it stands now.... they COULD say plumbing , electrical, carpentry on them.. but it still wouldnt have it in the last row in the tables. You're coming at this all wrong. The scenario you described is fundamentally the wrong thing to do. Why don't you give us the information relating to what you're actually look to accomplish with this and maybe we can give you a better solution. Quote Link to comment https://forums.phpfreaks.com/topic/300310-making-a-db-autofill-a-column-with-a-topic/#findComment-1530217 Share on other sites More sharing options...
Barand Posted January 22, 2016 Share Posted January 22, 2016 Why don't you give us the information relating to what you're actually look to accomplish with this and maybe we can give you a better solution. Good luck with that request. I asked for information 9 days ago but was totally ignored. Quote Link to comment https://forums.phpfreaks.com/topic/300310-making-a-db-autofill-a-column-with-a-topic/#findComment-1530218 Share on other sites More sharing options...
Muddy_Funster Posted January 25, 2016 Share Posted January 25, 2016 seems some people don't really want help, just answers. Quote Link to comment https://forums.phpfreaks.com/topic/300310-making-a-db-autofill-a-column-with-a-topic/#findComment-1530365 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.