Jump to content

veridicus

Members
  • Posts

    121
  • Joined

  • Last visited

    Never

Everything posted by veridicus

  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?
  15. Sounds like you have two options. Either pass the usertype or row2buttons array into the Display function, or have the Display function call something else to determine the usertype or row2buttons values.
  16. Very few people browse the web at 1280 or higher width. I suggest designing the page for 1024 width at most.
  17. Are the database settings identical on each server? The standard for mysql is to quote column and table names with backticks (`) and not single quotes. I think there's a setting to alter that. Try backticks or removing the quotes from the table name and you should be fine.
  18. Forgot to remove the GROUP BY and ORDER BY from each subquery and move them into the outer query, but you get the idea.
  19. Try a subquery: SELECT unixtime2, pagenum, count(DISTINCT ipaddress) as pagenumtotal FROM ( SELECT `unixtime2` , `pagenum` , `ipaddress` FROM `orders1` WHERE unixtime2 >20081031 AND pagenum != '' GROUP BY `unixtime2` , `pagenum` ORDER BY `unixtime2` , pagenum ASC ) UNION ALL ( SELECT `unixtime2` , `pagenum` , `ipaddress` FROM `ordersbp` WHERE unixtime2 >20081031 AND pagenum != '' GROUP BY `unixtime2` , `pagenum` ORDER BY `unixtime2` , pagenum ASC )) a (untested)
  20. You could turn on output buffering, but the way you're doing it now should be sufficient. Are you outputting anything, even just a space or carriage return, before the header call?
  21. From my experience I would use separate simple queries. If your data grows large, or you need to add more depth, you might see a big performance hit. Mysql is very efficient at running many small queries. From what I can gather coding your logic into PHP will be pretty straightforward.
  22. I don't think we have enough information to solve the problem, but I first suggest making sure you set both the From and Sender values in phpmailer. Then take a look at your mail logs and see how the mail is being handled. Are the addresses in the log correct?
  23. I would keep an array of safe sites and use preg_match instead of preg_replace. Then loop through the matches and str_replace those that are not safe.
×
×
  • 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.