Jump to content

veridicus

Members
  • Posts

    121
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://docforge.com/wiki/Main_Page

Profile Information

  • Gender
    Not Telling

veridicus's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Well, first you'll have to get a unique ID since you're using it across multiple rows. One option is to lock the table, then query for max(id) + 1. Then you'll need a multi-line insert statement, or multiple single line insert statements. In mysql, you can INSERT INTO tablename (id, field, value) VALUES (1, 'weapon', 'sword'), (1, 'attackpower', '5'), (1, 'cost', '100'); Then unlock the table.
  2. Mysql queries can keep a module (like mod_php) busy because it waits for each query to finish before continuing, so subsequent web requests spawn more httpd processes. The quicker your web app responds to each request, the more requests your system can handle. Sounds like you need to tweak performance.
  3. Ok, how about SELECT * FROM posts WHERE topic_id IN ( SELECT DISTINCT posts.topic_id FROM posts JOIN forums ON ( forums.forum_id = posts.forum_id ) JOIN users ON ( users.user_id = posts.poster_id ) ORDER BY post_time DESC ) LIMIT 4 Just remember that the subquery might be a performance hit because you're scanning and retrieving all of the records. It would probably be better to just run the non-subquery version (the first answer), then loop through each topic_id in code and select each record, since you'll only need to query for 4 records.
  4. I prefer strtotime... $bidtime = strtotime('today 2:00 PM'); if(time() > $bidtime){ echo 'it is'; } echo $thetime . '<br>' . $bidtime;
  5. If your $_SESSION['cart'] is empty, you'll get a query error because "IN ()" is invalid. You should change if(isset($_SESSION['cart'])){ to if(isset($_SESSION['cart']) && $_SESSION['cart']){ or something similar
  6. SELECT DISTINCT posts.post_id FROM posts JOIN forums ON ( forums.forum_id = posts.forum_id ) JOIN users ON ( users.user_id = posts.poster_id ) ORDER BY post_time DESC LIMIT 4 And if you want the whole record (although this might be a performance hit): SELECT * FROM posts WHERE post_id IN ( SELECT DISTINCT posts.post_id FROM posts JOIN forums ON ( forums.forum_id = posts.forum_id ) JOIN users ON ( users.user_id = posts.poster_id ) LIMIT 4) ORDER BY post_time DESC
  7. Are your tables MyISAM? Non-transactional table types can only auto-commit and won't show any error if you try to rollback.
  8. There are many pros and cons to frameworks, such as: * Code reuse - no need to recreate what's already been written and tested * Promoting code organization and best practices * "Free" upgrades (a framework may later get new features, which you then get for free in your apps that use it) * Performance can sometimes suffer if the framework is too generalized * Learning curve can be large. In my experience, the larger the project the more benefit to using a good framework. It's important to choose the right framework for the project.
  9. Sorry to bump this old thread. I came across it when I had a similar problem, but came up with a different solution that some might find useful. Tell mysqldump to output latin1 with no SET NAMES (--default-character-set=latin1 and -N parameters). Tell mysql to also use latin1 when importing (--default-character-set=latin1). This seems to prevent any double encoding / decoding of UTF8. On linux / unix, that would look like: mysqldump -u username -p --default-character-set=latin1 -N database > backup.sql mysql -u username -p --default-character-set=latin1 database < backup.sql See http://docforge.com/wiki/Mysqldump
  10. UPDATE jos_postalcodes3 SET countyname = 'Albany (NY)' WHERE county_zip = 36001;
  11. Any particular reason you're using a regex instead of urlencode?
  12. The only way to do it in one query is if you have a hard set limit on depth. Otherwise you would need application code or a stored procedure to continuously loop as it queries for each parent.
  13. It depends completely on the scenario. If the only uploads are many small thumbnails, for example, the limit would be low. But if I were allowing videos, the limit would be much larger. It depends on what type of files are being uploaded, how many you want to allow, how much disk space you're willing to use, bandwidth limitations, etc.
  14. Since you've already figured out how to save and publish entries, what's your question exactly?
×
×
  • 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.