Jump to content

king arthur

Members
  • Posts

    335
  • Joined

  • Last visited

    Never

Everything posted by king arthur

  1. There will only be one value in the array - the average of all the rows for that column.
  2. That is because the form is using the POST method to pass the vars, so there will be no $_GET vars. It looks like your SendEmail() function is using global vars to get the values, do you have register_globals switched on?
  3. session_destroy() does not take a parameter. The problem is that when you hit the back button, your browser will re-send the $_POST vars, so the $_POST['email'] and $_POST['password'] will be available in the script again. The browser would normally warn you about this. You should have a $_SESSION['loggedin'] variable that, if not present, causes the script to ask for the username and password, by destroying the session any such variable will be deleted. Don't just rely on whether the username is present in the $_POST vars.
  4. So you want to get all the data, from all the columns and rows, and sort the whole lot alphabetically while remembering which row each bit of data came from? If that's the case I think I would look at building a temporary table and doing the sort on that, I don't know if that's the best solution.
  5. Try adding a session_destroy() to your logout script, that may do the trick.
  6. Technically, although that may work, it's not quite correct as in the line [code] if($this->check($this->set_ip())) { [/code] you are passing a value into $this->check() which isn't expecting one, and using $this->set_ip() to return a value true or false, which it doesn't explicitly do. This would be better: [code] $this->set_ip(); if($this->check()) { [/code]
  7. The variable $_SESSION["StartTime"] is either not set or is empty in the second case, and therefore the line [code] $timediff = ($now - $_SESSION["StartTime"] + 1); [/code] evaluates to $now + 1.
  8. Not sure but you could try [code] SELECT car, cnt, gen, age, kids, count(*) as total FROM tablename GROUP BY car, cnt, gen, age, kids ORDER BY total DESC [/code]
  9. Because your set() function is trying to access the $ip variable but it is not within scope - it needs to be [code] function set() { if($this->check($this->ip)) { $sql = mysql_query("INSERT INTO log (ip, times) VALUES ('{$this->ip}', '1')"); } else { $sql = mysql_query("UPDATE log SET times = times + 1 WHERE ip = '{$this->ip}'"); } } [/code]
  10. Try it without the single quotes. INSERT....SELECT syntax is explained here: [url=http://www.phpfreaks.com/mysqlmanual/page/manual_SQL_Syntax.html#INSERT_SELECT]http://www.phpfreaks.com/mysqlmanual/page/manual_SQL_Syntax.html#INSERT_SELECT[/url]
  11. Try [code] $page = basename($_SERVER['PHP_SELF']); [/code]
  12. Then try a carriage return character too: "\r\n".
  13. I did games programming for nearly twenty years. Web development is a walk in the park compared.
  14. Try fwrite($fo, $towrite . "\n");
  15. Use mktime($hours, $mins, $seconds, $day, $month, $year). (Or zero out any of the parameters, e.g. for zero seconds, mktime($hours, $mins, 0, $day, $month, $year) )
  16. Well, in your first script you refer to the variable $_POST['rowsarr'] but in the form in the second script you use the name 'rowarr', I don't know if that may have a bearing on your problem?
  17. This is not a MySQL question. Somewhere in your script you need to set the variable $sb_country to the value you want, then the country corresponding to that value will be selected by default in the menu.
  18. Assembly language? You mean like Z80, 68000, SH2, 80x86, ARM7TDMI? Nah, don't know it!
  19. I'd say, probably, you are trying to update the 'sponsors' table in the 'chinese' database, and the 'chinese' database doesn't have a 'sponsors' table.
  20. When you use this syntax [code] mysql_query("INSERT INTO `example1` VALUES ('$name')"); [/code] you must supply values for all the fields in the right order, even if one of them is auto-incremented, so if your id field is first in the table for example: [code] mysql_query("INSERT INTO `example1` VALUES (NULL, '$name')"); [/code] the NULL will be replaced by the auto-increment value. Or you could use the syntax [code] mysql_query("INSERT INTO `example1` (name) VALUES ('$name')"); [/code]
  21. For that you would need to say what it is you're trying to do.
  22. What you are describing is a "many to many" relationship, i.e. each member can have a number of other members as friends, each of whom can also have many friends, etc. So you need a new table to break this up into a "one to many" relationship. So I would suggest a new table which records: userid friendid so that userid corresponds to the userid in your user table, and friendid also corresponds to the userid in the user table, of one of his friends. That way you could add the same userid many times, each with a different friendid, that way each member can have as many different friends as they like and you have not wasted memory with fields for those members who do not have friends.
  23. Unless your site's hostname is alaskanflyrod.com the script will not execute the header() function and the browser will not be redirected.
  24. What you really need to be doing is [code] function display_vars($username, $password) {   echo $username; //these give undefined variable warnings   echo $password; //have tried using global too } display_vars($user, $pass) [/code] This is a far more structured way than using global variables.
  25. Try [code] <? header ("Location: http://www.google.com/search?hl=en&q=".urlencode($_GET['input'])); ?> [/code]
×
×
  • 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.