Jump to content

bcamp1973

Members
  • Posts

    133
  • Joined

  • Last visited

Everything posted by bcamp1973

  1. That definitely makes sense. I'm guessing the average file size is probably going to be under 100k so it won't be a huge difference I imagine? I won't be dealing with high user loads either. hmm...decisions, decisions
  2. Just curious...i'm creating a CMS that manages documents (.txt,.doc,.psd,.jpg) among other things. I know files can be dumped into a database, but i'm wondering if it makes more sense to drop them into directories on the server instead for performance or other reasons?
  3. Sounds like it's an easier task than i thought. I just want to create a feed of simple records so users can be notified of updates and what records are updated. very similar to RSS feeds for news sites. I'm guessing RSS2 is the most ubiquitous of the three?
  4. I'd like to add an RSS feed to a PHP app i'm building, but really have no idea where to start. Any tips? Tutorials you know of? Hints? Cheers!
  5. Hmm, this is working on my local install of PHP 4.4.4 function esc($data) { global $dbc; if(ini_get('magic_quotes_gpc')) $data=stripslashes($data); return mysql_real_escape_string(trim($data),$dbc); } ...but i get the following error on my ISP's PHP 4.3.10 install Warning: mysql_real_escape_string() expects parameter 2 to be resource, null given in /path/to/functions.php on line 358
  6. This worked for me on my local install (4.1+) but it's not working on my ISPs install of 4.0.x. Is this query just not compatible? If that's the case how else can i write this to make ti work?? SELECT type, notes.type_id, notes.id, note FROM notes JOIN (SELECT MAX(id) AS max_note, type_id FROM notes WHERE project_id=1 GROUP BY type_id) AS sub ON notes.id=sub.max_note LEFT JOIN types ON notes.type_id=types.id WHERE project_id=1
  7. I'm working on a cms that's storing text. each entry usuallly isn't all that big, but there will be a LOT of entries generated. Is there a benefit to using TEXT vs BLOB or vis versa?
  8. fenway, thanks for following up. i guess i thought that since the 'id' was an INT and indexed it would be much quicker to query on than the DATETIME field (even if it's indexed) but I guess not (I'm very much a newbie)? The application i'm building isn't going to get high traffic so honestly it's not a big issue, however, i'm trying to learn as I go so I reduce mistakes on future apps Can you demonstrate how you'd create that query? Would it simply be a tweak to artacus' query above?
  9. wow, i was way off. ok, it's working now. many thanks artacus!
  10. well, here are my tables... NOTES_TYPES ----------------- id type NOTES ----------------- id type_id project_id note ...and my query... SELECT type, type_id, notes.id, note FROM notes LEFT JOIN notes_types ON notes.type_id=notes_types.id WHERE project_id=xxx GROUP BY type_id So, say a note can be any of the following types - comment (id #1) - complaint (id #2) - request (id #3) and in the NOTES table has multiple entries of each. I want my query to capture the most recent entry (highest notes.id #) of each of the 3 types, but not the previous entries...how does my query have to change to accomplish this?
  11. well, each record can have one of several 'type_id's and 'project_id's. so, on a query i would try to capture the most recent unique type_id's of a given project_id. does that make sense?
  12. for versioning i have table that always updated via INSERTs instead of UPDATEs so i have a history of previous changes and i can easily roll back. what's the most efficient way of always querying for the newest record? i could go by the 'updated' filed which is a timestamp, or the 'id' field which auto-increments. is there a built in MySQL function for this?
  13. our CMS provides the height and width of the video being embedded on the page. my problem is that i need to calculate whether the video is widescreen (16x9) or standard (4x3). based on it's height and width which may not be standard sizes. The math for this is a bit above my head?  Anyone have any hints?
  14. Can someone tell me the difference between using array_push($array,$x) and $array[]=$x ?  More importantly are there positives/negatives to one or the other?
  15. i'm building a CMS that will allow my client to build/maintain multiple sites from the same root directory. my thought is that anytime they add on a new site and the new domain has propogated we'll use .htaccess to send the users to the correct multi-site.  for example www.anewsite.com might actually point to www.clientsprimarydomain.com?siteid=33 the idea being that they'll be able to add as many sites as they want. then of course the new domains may have need addtional rewrites so that www.anewsite.com?page=contact_us goes to www.anewsite.com/contact_us/ is this the best way to approach this? mod_rewrite is kicking my butt...i don't even know where to start  :-[
  16. ok, i've been messing with str_replace(), preg_replace() and ereg_replace() and i'm not quite getting the results i want. Most likely because regular expressions mess with my head. I want to parse a string, and replace the first instance of select words (in an array) with the same word (case unchanged) but wrapped in a tag etc. So, i want the following... [code]<p>A doctor may need to review your records from your previous doctor's office</p>[/code] with... [code]<p>A <acronym title="A guy in a white coat">doctor</acronym> may need to review your records from your previous doctor's office</p>[/code] I'm having a couple problems. 1) how do i maintain the case of the word replaced?  My array of terms are all capitalized, but the term to be replaced may or may not be.  2) how do i only replace the first instance? Finally, if someone feels up for giving me a dumbed down difference between ereg_replace and preg_replace i'd appreciate it. The PHP manual doesn't spell it out clearly enough for me :P
  17. i'm building a simple website CMS.  on loading a page the database is queried for the page details. the query hits 3 tables..."pages","images" and "links". Can i write a single query to grab all the needed data from all 3 tables to build the page?  The "images" table contains one or more images for each page, and teh "links" table contains one or more links for each page. The tables look like so... pages ------------- id page_title page_pictures ------------- id picture_id page_id links ------------- id page_id link I'm using MySQL 4.1.15. So far i've only been able to get all this data using 3 separate queries.  Not sure if that's considered "messy" or if it's really the only way to go?
  18. sorry, i didn't explain myself well enough :)  my goal is to have the email address show up on a web page so it remains readable to the viewer.  So they would see something like, "Please contact support@whatever.com if you have issues with this website", but in the code the address needs to be encoded so the spambots can't read it.  does that make sense?
  19. I'd like to create a function that detects email addresses in text and rewrites them so they're spam proof.  has anyone done this?  has it been effective for you?  how did you go about it?
  20. I'm building a modest CMS.  In it, i want the ability to "roll" back to previous versions of pages when making updates.  I'm unclear as to how i might structure the DB tables to make this efficient.  My first thought was to jsut do an insert anytime a page is "updated".  However, this creates a new id so i'm not sure how i'll roll back if I don't then have a unique identifier.  Also, since every single update would insert a new record, even with proper indexing i'm probably going to create performance issues right?  Any suggestions?
×
×
  • 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.