Jump to content

dachshund

Members
  • Posts

    312
  • Joined

  • Last visited

Everything posted by dachshund

  1. Hi Vinny, Sorry if I was initially unclear about what I was trying to achieve, the rough code below is what I'm trying to make work $sql = mysql_query("SELECT DISTINCT tag_one + tag_two + tag_three FROM table ORDER BY (number of occurrences) DESC"); while($rows=mysql_fetch_array($sql)){ echo $rows['tag_one + tag_two + tag_three]; }
  2. does anyone know if the above is possible, and how you would group together the columns to echo out as one?
  3. basically Im trying to work out how to make something like this work $sql = mysql_query("SELECT DISTINCT tag_one + tag_two + tag_three FROM table ORDER BY (number of occurrences) DESC");
  4. thanks. i'm assuming this is the wrong way to echo out the results? $sql = "SELECT tag, COUNT(*) AS number_occurences FROM (SELECT tag_one AS tag FROM content UNION ALL SELECT tag_two FROM content UNION ALL SELECT tag_three FROM content) AS merged_tags GROUP BY tag ORDER BY COUNT(*) DESC"; $result=mysql_query($sql); while($rows=mysql_fetch_array($result)){ }
  5. apologies, i don't think i explained myself too well to begin with. for each article, 'tag1' can be defined as any word you wish, such as "amazon" or anything else. this is the same as tag2 and tag3, you can enter any tag you like. I realise this would normally be done with one comma delimited column, but it was set up like this a while ago and works fine for the time being as we generally don't need more than 3 tags per article. basically what I want to do is find out what words have been used most as a tag. so the query would simply list popular tag words in order of how many times they have been used. i would like the end echo to be something like the below amazon - 26 times antarctica - 22 times london - 4 times new york - 2 times the problem is "amazon" could have been entered as tag1 on one article, and tag3 on another article, so I need to search and could all three columns as one. hope that makes a little more sense and thanks for your help so far!
  6. Hi, I have three tag columns in my mysql database - tag1, tag2, and tag3. Is it possible to count how many times tag words appear in tag1, tag2, and tag3 combined and then list in order of how many times they appear? Thanks
  7. it appears the links are being sent out to people as messages on facebook via. hacked accounts. has anyone heard of this happening before?
  8. or how I can just echo 'invalid request' if they go to an address like that?
  9. any ideas?
  10. Hi all, I seem to be coming under some sort of hacker attack by which hundreds of "visitors" go to the index.php page followed by a code which is a number then an equals sign then another number, for example "?1o4t95spb5=8abd1befd07bd4" Does anyone know what this is and how it can be stopped? Thanks
  11. Hi, I'm having trouble with my $_GET command picking up spaces within the URL, for example if it says index.php?brand=carhartt that works fine, but if it says index.php?brand=Happy%20Socks it can't recognise there is a space. Any help? Thanks
  12. worked it out, it's $pos = strpos($comment, 'http://'); if ($pos !== false) { $pos = '1'; } if (strlen($comment) != strlen(strip_tags($comment)) OR $name == '1' OR $comment == '1' OR $pos == '1'){
  13. Sorry, here: $pos = strpos($comment, 'http://'); if ($pos === true) { $pos = '1'; } if (strlen($comment) != strlen(strip_tags($comment)) OR $name == '1' OR $comment == '1' OR $pos == '1'){
  14. Ok, so I tried this, but it doesn't seem to be working. Can anyone see where I've gone wrong. Thanks for your help. if ($pos === true) { $pos = '1'; } if (strlen($comment) != strlen(strip_tags($comment)) OR $name == '1' OR $comment == '1' OR $pos == '1'){ echo 'comment failed'; }
  15. Hi, I have a comment form which currently makes sure people do not post any html with the below code: <?php if(strlen($comment) != strlen(strip_tags($comment)) OR $name == '1' OR $comment == '1'){ ?> I am still getting a lot of spam that contains a web address such as http://www.viagra.com. To stop these comments going through, I want to check to see if a web address has been included in the $comment, and if so, not allow it. Can anyone help? Thanks
  16. Hi, I have the following code but I want to skip the very first result (or row) as I already have that echoed in a different format above. $sql = "SELECT * FROM content WHERE `live` LIKE '0' AND `date` >= SUBDATE(CURRENT_DATE, 1) ORDER BY `views` DESC LIMIT 40"; $result=mysql_query($sql); while($rows=mysql_fetch_array($result)){ Thanks
  17. Hi, I'm trying to find all the MySQL entries from the last 24 hours. So far I have this. I just don't know how to take 1 day off the current time. $lastday = date('Y-m-d h:i:s'); $sql = "SELECT * FROM content WHERE `live` LIKE '0' AND `date` >= '$lastday' ORDER BY date DESC LIMIT 40"; $result=mysql_query($sql); while($rows=mysql_fetch_array($result)){ Thanks in advance, Jack
×
×
  • 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.