Jump to content

NL_Johan_UK

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

NL_Johan_UK's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. But can I kill those seeminly pointless threads that are sleeping?
  2. got a hosting deal, so remote.
  3. I don\'t know how to get direct access to the server. I do everything through ftp and phpmyadmin. How do I access httpd.conf? Is there anything I can change in phpmyadmin? I have mysql_close(); under every page now but occasionally the error still shows up. When I do \"SHOW PROCESSLIST \" as a query in phpmyadmin I get a list of 16 sleeping threads. Some for as long as 23000 + seconds. Can I kill all them without harm? Now Im closing all connections none should stay sleeping should they?
  4. I suppose this is a luxury problem, it show increasing visitors BUT! My site is messed up... Warning: mysql_connect() [function.mysql-connect]: Too many connections MySQL Error : Connection Error Error Number: 0 etc.. What can I do to stop this? Use mysql_close()? It doesnt seem to get better, in fact non of the site appears when I add that in the last script that is being executed... Help is appreciated!
  5. Hey everybody! Maybe someone can help with the following... I have a table with player names and their scores. To display the ranking I select names and scores and sort by scores desc. Now I can while-loop my way through the whole list. No problems.. BUT: Now I want to find only one persons position in the rankings table. Imaginary Query: SELECT row_number, names, scores FROM thetable WHERE name=\'$name\' ORDER BY scores desc echo hey dude you are $row_number i nthe rankings! How can I get this number? Do i need to make a temp field named ranking or something? Can I auto increment this temp field? Id like to do this on the database side so i dont have to pull all data through the pipe for just one dude... The scores change so often I dont want to save their positions in a field. If I understand correctly, I think I need an inverse of mysql_data_seek. So instead of giving the pointer and getting the data, I need to give the data (name) and get the pointer (position in table). Is this possible? Cheers....
  6. I think you mixed up some words like qestion and answer but let me try. You only need to store the right answer. I take it you use a drop down select option list , so all answers have a value. To see whether it was the right answer do this: $query = "SELECT COUNT(*) FROM your_table WHERE correct_answer_field = $visitors_answer"; $result = mysql_query($query); if(mysql_num_rows($result) < 1) { echo\'they were wrong\'; } else { echo\'they guessed it right\'; }
  7. I code my php in PHP Coder, it has a great function called \'find matching brace\' . If goes all the way down your script, you know you forgot one. When the error tells you it\'s the last line of your code, or the one before, it is always a missing brace, or you forgot ?> . Just a tip... One more thing, you might want to use .... password = PASSWORD($password) WHERE... etc. It encrypts the password. You don\'t want to know all your friends / clients passwords now do you? When they log in, just match it like this: SELECT COUNT(*) FROM user_table WHERE password = PASSWORD($password) AND user_name = \'$user_name\' Good practise for privacy in your coding..
  8. I assume you have all questions stored in tables already. For a random question select, do this query first: SELECT MIN(id), MAX(id) FROM your_question_table I assume the ID is autoincremental, with no deleted records. Then you have the minimum and maximum ID\'s. Use them for this: srand((double)microtime()*1000000); $random_number = rand(0,100); where 0 is your minimum and 100 your maximum... Now select your random question: SELECT question FROM your_question_table WHERE id = \'$random_number\' There are many sources online on random strings and numbers, just search in google...
  9. That is sort of what I meant indeed, but I dont know if mysql gonna have that. Just do the extraction in PHP and save the results in variables you can use for the second query...
  10. How about selecting with Limit = 0,1 and sort by mytime desc. This way you have the latest date, you can substract the month out of it like explained above and use that in the rest of the code / queries.
×
×
  • 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.