Jump to content

mb81

Members
  • Posts

    120
  • Joined

  • Last visited

    Never

Everything posted by mb81

  1. mb81

    CRUD!

    dbo, you may want to check out the scaffolding feature with codeigniter (www.codeigniter.com) I have been trying to develop a customized CMS/module based system that will have these types of things also.
  2. If I was starting from scratch, I would have created one table for all the different items, and a category for each item, then in your php code, you can say that if it's in the order form category, then you need a field or order number, or total amount, or whatever your fields are, where as cd might have a title and description. The other option would be to do the index file as you said, but I wouldn't create a seperate index, just use the indexes that already exist, but also include the tablename, so your data looks like this [pre] barcode tablename tableid 0000000001 cds 5 0000000002 orderforms 3 0000000003 servicerequest 4 [/pre]
  3. Don't create a new page for every school, you need to make sure your casestudies table has a primary key (usually named id and it can autoincrement itself), then you create a link like schoolinfo.php?id={id}
  4. Sorry about that, meant to modify the original post, not post as a reply.
  5. My question is why are you looking at primary keys from different tables at the same time if it is a different set of data fields? If this is from an sql query, then just set an additional field for each table, example: SELECT 'E' AS persontype, name, address FROM TABLE_employees UNION SELECT 'C',name,address FROM TABLE_clients
  6. If you are sending Artist, Song, and id from the page before this one, where does that information come from? Yes, I agree that it wouldn't be a problem if it was all in one table.
  7. Matthew (great name by the way), There is a great function called empty(), it returns FALSE if var has a non-empty and non-zero value. The following things are considered to be empty: * "" (an empty string) * 0 (0 as an integer) * "0" (0 as a string) * NULL * FALSE * array() (an empty array) * var $var; (a variable declared, but without a value in a class) so just do a check like this: if (!empty($Course)) { // other code here } else { // try again code here }
  8. Why not use a 3x3 table?
  9. You need to be sending a variable from the previous page that tells you which table it's in, then get rid of the foreach loop and display just the one record.
  10. mb81

    ?page=

    We use an .htaccess file and a very simple rewrite to create different pages from one file: RewriteEngine On RewriteRule ^([a-z0-9]+)$ content.php?id=$1 [L] This also helps us with search engine optimization, because the pages will index, because the urls are like this: http://www.mysite.com/page http://www.mysite.com/anotherpage instead of like this: http://www.mysite.com/content.php?id=page Crawlers will ignore the parameters (everything after the ?), so the only page that gets indexed is the default page.
  11. -- The first mistake is in your data structure, why do you have different tables for different genres of music? -- If you don't fix that, then you have to have some way to determine which table that particular song is in before you display it. I am assuming that your id is the auto increment id for that table, so all 5 tables are going to have an id #1, all 5 will have a #2, all 5 will have #3, so you are going to get 5 results every time.
  12. Distant_storm, the facebook app is really heavy on object-oriented programming (OOP), so if you don't have a really firm grasp of OOP, you're going to be dead in the water.
  13. My suggestion would be to create an array of the string segments you want to match it to, then search for each individually, then all of them have to evaluate true for it to be a valid string. A CRUDE ALGORITHM: HAYSTACKSTRING = "BLAH BLAH BLHA ABC XYZ" SEARCHSTRINGS = ARRAY ("ABC", "XYZ") GOODSTRING = TRUE FOREACH (SEARCHSTRING AS NEEDLESTRING) { IF ( NOT (NEEDLESTRING FOUND IN HAYSTACK STRING)) { GOODSTRING = FALSE } } IF (GOODSTRING) { WHATEVER YOU WANT TO DO TO IT }
  14. Hey, we just took over a hosting client that was using a CGI bulletin board and I put it in our CGI folder, but I am getting an Internal Server Error with the following line in the error_log: [Fri Nov 30 14:35:33 2007] [error] [client 68.221.6.210] Premature end of script headers: Ultimate.cgi Anybody know what I can do to fix this? Thanks
  15. I am a webmaster for a marketing company and I typically will be working on 5 to 10 websites at one time, making small updates here and there. I currently use Dreamweaver 8, which helps because you can continue to work on a site while the upload or download is going in the background, but it does not let me go work on another website if I am uploading on that one. I have been using external FTP programs, but I found more and more, that I might have 3 to 4 sites that I need to upload stuff to, so even with an FTP and Dreamweaver going, I am still waiting for uploads to move onto the next project. Are there any FTP programs that you use that handle mulitple sites well, including possibly queuing uploads to multiple sites? Thanks
  16. My server doesn't seem to be recognizing information being sent from a form (below). It grabs the categories_id, but the categories_name and the file item are not getting sent or not being received properly into the $_POST superglobal array. Any ideas why this might be happening? This is a form in osCommerce, but I don't think this is an osCommerce issue because another copy of oscommerce works elsewhere on our server just fine. Thanks, Matt
  17. Yes, I realized that once I posted it. There is, however, still a syntax error on the word UNION. Here is the code and the error again: SELECT * FROM CLASSES_areas WHERE LENGTH( state1 ) >0 UNION SELECT * FROM CLASSES_areas WHERE LENGTH( state2 ) >0 It doesn't seem to matter what I include in parenthesis, even though that the MySQL 5.0 documentation said I should include the entire SELECT statement in parenthesis
  18. (SELECT * FROM CLASSES_areas WHERE LENGTH(state1)>0) UNION (SELECT * FROM CLASSES_ares WHERE LENGTH(state2)>0) I am getting a syntax error right after UNION, what is wrong with this query? Here is the tables structure: CREATE TABLE `CLASSES_areas` ( `id` int(11) NOT NULL auto_increment, `areaname` varchar(100) NOT NULL default '', `shortname` varchar(50) NOT NULL default '', `state1` varchar(5) NOT NULL default '', `state2` varchar(5) NOT NULL default '', `state3` varchar(5) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=4 ; Any help would be really appreciated. Thanks, mb81
  19. Hello all, I have a query where I need to get the 10 most recently added lines in a particular MySQL table, but I need to process them starting at the oldest of the 10. Is there a way to reverse the order it returns the rows if I am using a datetime field in DESC order to sort them? I thought about running the whole query, getting the number of rows, and then doing another query to limit to the last 10. I also thought about running the query, then seeking to the 10th to the last row and going from there. Are there any other suggestions or some magic syntax I am missing?
  20. I had posted this probably a year ago and didn't get an answer that I could understand and actually worked and the ugly bug has reappeared, so I want to try again, maybe I have gotten smarter, maybe someone can use simple language for me. I have two "core" classes, siteclass and htmlclass. All of my core functions are in site class (queries, fetches, other common functions) and html class is a class I use for formatting of tables and forms. So, here is my OOP layout: siteclass htmlclass extends siteclass module1class extends htmlclass module2class extends htmlclass All of my other modules extend from htmlclass so they have the html and siteclass functions. Here is my problem: During the initialization of siteclass, I set configuration variables from the database. Then, I initialize htmlclass and my moduleclasses. When I try to access my configuration variables through my module classes, they do not exist. The variables that I have set for my siteclass do not extend to my htmlclass or my moduleclass. Any thoughts?
  21. Hello All, I have a new project that I wanted to share with you and see if anybody had anything similar and could provide any helpful information, tips or tricks on database structure, etc. The project is a video production tracking system. The client is a marketing and production company that produces weekly television shows for a variety of clients. What they are looking for is a full service tracking system that can manage what videos they are producing, when they are delivered to the television studio, when they are, the content of the videos, etc. Some important keys to development: - Each different show may have different production milestones. For example, some of the programs are shot in the studio, and some are shot by the client, some of them have post-production, some don't. Each production milestone must be tracked. - Each show has a weekly air date and a weekly "log" date (this is the deadline by which it must be at the studio). The log date is different based on what day of the week the progam is aired and on what network. - They know the air schedule in advance, but the production of the videos is done with only a few days notice, including notification that the show will be a rerun from previous weeks, so we must track the production of the show before we can label it with a number or title. - In cases where there are reruns, the production cycle changes for the show that week (the tape would still be at the television studio). Has anybody had any experience with this type of system and could provide any helpful suggestions regarding db structure or algorithms that they had to overcome? Thanks, mb81
  22. I have done the same thing, I actually prepare the statement before I send it to the query function to reduce the length of each function. I have the following functions: buildselect( tablename as string, fieldnames AS array, defaults to Array(*), parameters as Array or String) buildupdate( tablename as string, values AS array (fieldname as key, new value as value), parameters As array or string) builddelete ( tablename as string, parameters AS array or string) For the parameters, if the parameters are an array, I join them with "AND" and assume '=' (ex. Array('category'=>1,'date'=>'2007-03-15') becomes "category='1' AND date='2007-03-15') (I probably should add support for "OR", but haven't had the need yet), if the parameters are a string, I just take them as is (I use this when I need comparisons other than =) This three functions return a string, which I send to the query function, so a call might look like this: $site->query($site->buildselect("categories",Array('id'=>1)); Hope that helps, if you send me a private message, I will be glad to e-mail you the full code. P.S. I have also built into my fetch function the option of sending a string, it sends the string to the query function, then performs the fetch. This saves a line of code when I just need one row of data.
  23. I agree with this, just assign a parent_id of 0 to all top level forums, then all others can use the unique id as their parent id. One of my big projects right now uses XMB forums and that's the way they do it. I have also used it for a simplified structure for a resource browser that uses a directory structure. The subforum table is very discouraged, because what happens if you want to create sub-sub-forums, or sub-sub-sub forums. Then you are multiplying your workload.
×
×
  • 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.