Jump to content

XpertWorlock

Members
  • Posts

    123
  • Joined

  • Last visited

Everything posted by XpertWorlock

  1. Yeah I had the idea of doing something similar to this, I just couldn't figure out how to do it properly. For future reference to anyone viewing this thread, it does work
  2. I think I got it working properly using (a modified version of) the query from the following page http://stackoverflow.com/questions/2596489/how-to-select-the-last-two-records-for-each-topic-id-in-mysql
  3. What I would like is it to be sorted by date ASC but get 2 results for each supply. Here I have a better example that people can understand better: Table : Comments post_idcommentdate 123Hi there1312323443 123How are you131232454 123How are you Jim1312342454 146How are you131232454 146How are you131232454 Output : post_idcommentdate 123How are you131232454 123How are you Jim1312342454 146How are you131232454 146How are you131232454 So in this example, I would want to take 2 of the latest comments by each post
  4. What I'm trying to do is group by supplies but return 2 of each and than sort by date TABLE NAME : FRUIT supplies | type | date 4 | apple | 1357656565 4 | orange | 123333321 4 | pear | 1212312321 6 | grape | 1312312321 6 | grapefuit | 13121312321 Results in : 4 | apple | 1357656565 4 | orange | 123333321 6 | grape | 1312312321 6 | grapefuit | 13121312321 For the life of me I can't get my brain to wrap around it. I'm pretty sure I've done this before and it had to be done by using a subquery. Can anyone help?
  5. Easy PHP class to send HTML e-mail. I was in the same boat and wanted a consistent design across all e-mails (forgotten passwords, etc). I'd suggest a trial run to yourself always to make sure it's working properly http://blog.hostgrenade.com/2011/07/31/php-email-class/
  6. Okay, I have caches of pages and I need to be able to get a sql query to search more than one keyword, the table goes as following : KEYWORD URL ----------------------- martial home arts home martial about Example : if I search "martial arts", how would I get back results in order "home","about". As "home" has both words, where "about" has only 1 word? Any help guys?
  7. Hey guys, I have a SQL query that goes like this SELECT page FROM keywords WHERE keyword_id = '17' UNION SELECT page FROM keywords WHERE keyword_id = '36' ORDER BY weight DESC SQL TABLE goes as this keyword_id page weight 17 example.php 20 36 example.php 80 17 test.php 5 36 test.php 10 So for this example, I need the results to return the "example.php" row first. I need it to add the 2 weights together (100,15) by page So the outcome would be : example.php test.php Any help guys
  8. First time I've ran into this problem. What I am doing is getting the content of a page, cutting it in half (for big pages), and than putting them back together (not in this). $half = intval((strlen($html) / 2)); $html1 = substr($html,0,$half); $html2 = substr($html,$half); Now most of the time this works perfectly fine, as all I'm doing is what I explained above. Unfortunately on one page I got a silent error (the script just stopped even though report all is on), but it seems to be "Cannot convert to ordinal value" on the line where $html1 is set. I could fix it with htmlspecialchars() but it makes the strings bloated. Any help guys?
  9. Yeah I was on my last hopes when I started the thread, thanks for clearing that up for me.
  10. Thanks for the reply, Correct me if I'm wrong, but I think filetype is for files on my server, unfortunately I'm looking to tell if a url on another server is a folder or not.
  11. This one stumped me, but maybe someone has figured it out. I'm trying to write a script that is able to decide whether a remote url is a directory or a file, this is fine until it comes to mod_rewrite(rewritten?) urls. ex. http://www.example.com/test Now this could be test.php,test.html etc., but in the rare case, it could also be a folder (example.com/test/index.php). Anyone have any ideas?
  12. trying to get a reg exp to get the current directory of a string (not working directory). So far what I have is : http\:\/\/www\.([a-zA-Z0-9\-\.]+)([a-zA-Z0-9\-\/]*) the problem is it will capture the filename too : ex . http://www.example.com/testFolder/test.php output -> http://www.example.com/testFolder/test I'm assuming I have to use a look ahead to ensure there is no extension, but I've never fully grasped look aheads. Can anyone help?
  13. got it, in case people would like to know ^(?!www)([a-z]*)\.
  14. trying to get a reg exp to work with any characters except certain words ex : www.adssa <-ignore as.ads <-capture Current code : ^([a-z]*(www))\. this captures www, I just can't figure out how to capture the opposite
  15. That is exactly what I wanted, I figured with this many years of SQL that there had to be a way. Thanks
  16. Hi, was wondering if it is possible to count all the rows in a table, but only query let's say the first 20 results. Currently I have to do two queries. One counting all the rows and one getting the information and limiting it to 20. Is this possible?
  17. I knew it was something simple but the ol brain wasn't thinking.
  18. Let's say I have the following JSON object : ({"test":{"status":"good"}}) Now how would I add "test2" to make it : ({"test":{"status":"good"}, "test2":{"status":"bad"} }) Thanks for any help
  19. It was my fault, a mod_rewrite problem I had with query string. Thanks for taking the time to reply
  20. Hi, I have a column that contains prices, the type of the column is "Decimal(16,2)". I'm having a problem querying when a price should be above a certain level. Ex. Select * FROM table WHERE price > '500.00' I'm assuming I have to change the query a little bit.
  21. Yes, thanks for replying anyways [QSA] for people that read this thread and want to know how I solved it
  22. Example URL that I would use : http://mysite.com/classifieds/category?page=2&priceFrom=400.00 RewriteCond %{QUERY_STRING} ^page=([0-9]+) [OR] RewriteCond %{QUERY_STRING} ^priceFrom=([0-9]+) RewriteRule ^classifieds/([a-zA-Z',\s]+)/?$ /classifieds.php?search&category=$1&page=%1&priceFrom=%2 [L,NC] It determines what page is when printed out, but "priceFrom" comes up empty. What am I doing wrong? I need it to work whether both or only one are set
  23. Thanks, those little tricks you never seem to learn soon enough
  24. Seem to have a loop occurring, can't seem to figure out how to stop it. EXAMPLE : newsArchives.php?month=5&year=2010 RewriteRule ^newsArchives/([0-9]+)/([0-9]+)/?$ /newsArchives\.php?month=$1&year=$2 [NC,L] RewriteCond %{QUERY_STRING} ^month=([0-9]+)&year=([0-9]+)$ RewriteRule ^newsArchives.php$ /newsArchives/%1/%2/? [NC,R=301,L] The top one is for a different script, but I am assuming the bottom one is changing to the top rewrite and than looping over and over. Any quick ideas how to fix?
×
×
  • 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.