Jump to content

draxxus

Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

draxxus's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Is it better to use switch cases like this: URL = index.php?content=home $content = $_GET['content']; switch($content){ case "home": include "home.php"; break; } or could i do like URL = index.php?content=index.php $content = $_GET['content']; include ("$content"); Reason is I have a large menu with 40+ links and writing a bunch of switch cases will be long and tedious. Just making sure. Thanks!
  2. Maybe write a local script to gather all the names? You can split the file names up into seperate strings wherever a "_" is. Then have another script append any neccessary info so that you could just copy/paste into sql. Only way I can think of :)
  3. Is there a more efficient way to delete stuff than having a million DELETE statements inside of a million other SELECT statements? I see that it works, but the problem is when it comes to a place where there is nothing to delete (but something needs to be later down the path) it just stops the whole deleting process. I'll try to explain it as best I can. I have a database for schools. I have three tables for schools, teachers, and assignments. The assignments relate the the teachers table, and the teachers table relates to the schools table. The objective is to delete a school (and everything that corresponds with that school, i.e. the teacher) from the admin panel. Currently, my deleting process looks like this - [!--coloro:#990000--][span style=\"color:#990000\"][!--/coloro--][b] SELECT statement to select the school information while loop for the rows as results { SELECT statement to select all teacher information based on the school's ID while loop for the rows as results { DELETE statement to delete the assignments based on the teacher's ID } DELETE statement to delete all the teachers in that school } DELETE statement to delete the school itself[/b][!--colorc--][/span][!--/colorc--] The problem is if I try to delete a school that has no teachers in it, it'll stop at the DELETE assignments (because without any teachers, there can be no assignments) and won't continue on. How would I enable it to continue on even if there are no teachers? Thanks for the help!
  4. Just wanted to make sure my db is properly setup before I go off on my application. It'll be a sort of user cms system that provides users with their own web pages with their own content, etc. (the content/layout is established by me though, they're just going to be filling in fields like a profile or something) I guess it works simularly to a blog. The colors show the rows that are dependant on eachother. ADMINISTRATION TABLE // this table is for the users to manage their website [!--coloro:#CC0000--][span style=\"color:#CC0000\"][!--/coloro--][b]user_id[/b][!--colorc--][/span][!--/colorc--] (int, auto-incre) field field field field CONTENT CATEGORIES // this table allows them to make a category in which content will be put [!--coloro:#000099--][span style=\"color:#000099\"][!--/coloro--][b]category_id[/b][!--colorc--][/span][!--/colorc--] (int, auto-incre) [!--coloro:#CC0000--][span style=\"color:#CC0000\"][!--/coloro--][b]user_id[/b][!--colorc--][/span][!--/colorc--] field field field CONTENT // the content to be stored inside the categories [!--coloro:#006600--][span style=\"color:#006600\"][!--/coloro--][b]content_id[/b][!--colorc--][/span][!--/colorc--] (int, auto-incre) [b][!--coloro:#000099--][span style=\"color:#000099\"][!--/coloro--]category_id[!--colorc--][/span][!--/colorc--][/b] field field field The actual database is more detailed with many more tables but they're all setup basically this way, stacked on one another. I'm pretty sure this is how it should be done, but it sure seems that if I want to delete something at the bottom of the tree (in this case the CONTENT table) than its quite a bit of work to acquire all the info to simply find the specific row to delete. By that I mean I have to select the user's info from the top and keep going down the list selecting the keys just to delete a row at the end. It seems more efficient to just put user_id in every table so if I wanted to delete something I simply find it in the table based on the user_id. I appreciate any thoughts you guys could provide. draxxus
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.