login  Naam:   Wachtwoord: 
Registreer je!
 Forum

mysql klopt niet

Offline Zerato0 - 09/07/2005 19:26
Avatar van Zerato0Onbekend hallo,

CREATE TABLE dopewars (
id serial,
name text,
password text,
score int,
onthemove boolean,
player text,
date datetime DEFAULT now ( )
);

CREATE UNIQUE INDEX dopewars_name ON dopewars (name);

CREATE TABLE dopescores (
id serial,
name text,
password text,
score int,
date datetime DEFAULT now ( )
);

dit vondt ik op internet maar ik wou het ff uitproberen op me host maar dan zegt ie:

#1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'serial,
name text,
password text,
sc

ik snap er echter niks van

en dit zijn de requirements:

PostgreSQL 7.3

ik snap het niet goed maar misschien kan iemand me helpen

bvd,mark

4 antwoorden

Gesponsorde links
Offline MothZone - 09/07/2005 19:28
Avatar van MothZone PHP ver gevorderde CREATE TABLE dopewars (
id tinyint,
name text,
password text,
score int,
onthemove boolean,
player text,
date datetime DEFAULT now ( )
);

CREATE UNIQUE INDEX dopewars_name ON dopewars (name);

CREATE TABLE dopescores (
id tinyiny,
name text,
password text,
score int,
date datetime DEFAULT now ( )
);

probeer dit eens
Offline Zerato0 - 09/07/2005 19:33
Avatar van Zerato0 Onbekend nu krijg ik deze foutmelding:

#1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'boolean,
player text,
date datetime DEFAULT now ( )
)' at li
Offline Tuinstoel - 09/07/2005 19:42
Avatar van Tuinstoel PHP expert Je weet volgensmij ook echt niet waar je mee bezig bent.
Je post dit in MySQL, maar het is PostegreSQL, dus dat kan niet.

Je moet dus een PostegreSQL server hebben dude.
Offline Zerato0 - 09/07/2005 19:43 (laatste wijziging 09/07/2005 22:53)
Avatar van Zerato0 Onbekend dat van postresql is opgelost maar kijk ik heb nou het volgende:

  1. <?php
  2. if (!$player || $logout) {
  3.  
  4. $uid = "";
  5. $player = "";
  6.  
  7. switch ($action) {
  8. case "login":
  9. $name = trim(str_replace(",", " ", substr($name,0,20)));
  10. $password = trim(substr($password,0,15));
  11. if (addslashes($name) != $name || (strstr($name, " ") && $new)) {
  12. $error = "Invalid characters in username.";
  13. } else if (addslashes($password) != $password) {
  14. $error = "Invalid characters in password.";
  15. } else if ($name != "" && $password != "") {
  16. $language=$lang;
  17. $lname = strtolower($name);
  18. $qry = "select * from dopewars where lower(name) = '$lname';";
  19. $result = $db->qry($qry);
  20. if ($new) {
  21. if ($result != array()) {
  22. $error = "There already exists a user named \"$name\".";
  23. } else {
  24. check_max();
  25. $player["name"] = $name;
  26. $player["cash"] = 5000;
  27. $player["debt"] = 4761;
  28. $player["bank"] = 0;
  29. $player["guns"] = 0;
  30. $player["bitches"] = 2;
  31. $player["space"] = 20 + $player["bitches"] * 10;
  32. $player["held"] = 0;
  33. $player["life"] = 100;
  34. $player["guns"] = array();
  35. $player["drugs"] = array();
  36. $player["drugprices"] = array();
  37. $player["prices"] = array();
  38. $player["destination"] = 1;
  39. $player["snitches"] = array();
  40. $player["currentsnitches"] = array();
  41. $player["snitchreport"] = array();
  42. $player["fighthistory"] = array();
  43.  
  44.  
  45. $pl = addslashes(serialize($player));
  46. $qry = "insert into dopewars (name, password, score, player) values ('$name', '$password', 0, '$pl');";
  47. $result = $db->qry($qry);
  48.  
  49. $uid = $name;
  50. }
  51. } else {
  52. if ($result == array()) {
  53. $error = "No such user";
  54. } else if ($result[0]["password"] != $password) {
  55. $error = "Invalid password";
  56. } else {
  57. check_max();
  58. $uid = addslashes($result[0]["name"]);
  59. }
  60.  
  61. }
  62. }
  63. if (!$uid) {
  64. echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">";
  65. echo "<html><head><title>dopewars</title><link rel=\"stylesheet\" href=\"default.css\" type=\"text/css\"></head><body><h3>dopewars - login</h3>";
  66. echo "<div style=\"height:20px;margin-top:30px;\">";
  67. if ($error) {
  68. echo "<p>$error</p>";
  69. }
  70. echo "</div>";
  71. echo "<form action=\"$PHP_SELF\" method=\"POST\">";
  72. echo "<p>name: ";
  73. echo "<input name=\"name\" type=\"text\" value=\"\" class=\"button\" size=\"10\" maxlength=\"20\"></p>";
  74. echo "<p>password: ";
  75. echo "<input name=\"password\" type=\"password\" value=\"\" class=\"button\" size=\"10\" maxlength=\"15\"></p>";
  76. echo "<p>language: ";
  77. echo "<select name=\"lang\" class=\"button\"><option value=\"EN\">English</option>";
  78. if (strtolower($HTTP_ACCEPT_LANGUAGE) == "nl") {
  79. echo "<option value=\"NL\" selected>Nederlands</option>";
  80. } else {
  81. echo "<option value=\"NL\">Nederlands</option>";
  82. }
  83. echo "</select></p>";
  84. if ($new) {
  85. echo "<p><input name=\"new\" type=\"checkbox\" checked> <label for=\"new\">create new account</label></p>";
  86. } else {
  87. echo "<p><input name=\"new\" type=\"checkbox\"> <label for=\"new\">create new account</label></p>";
  88. }
  89. echo "<input name=\"action\" type=\"hidden\" value=\"login\">";
  90. echo "<input type=\"submit\" value=\"login\" class=\"button\"> ";
  91. echo "</form>";
  92. echo "</body></html>";
  93. }
  94. break;
  95.  
  96. default:
  97.  
  98. // genereric script to check for drunkmenworkhere editions
  99. // comment out next two lines, they're only useful on drunkmenworkhere.org
  100. @include("editions.php");
  101. @checkEdition();
  102.  
  103. echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">";
  104. echo "<html><head><title>dopewars</title><link rel=\"stylesheet\" href=\"default.css\" type=\"text/css\"></head><body>";
  105. echo "<h2>dopewars</h2>";
  106. echo "<p>(deal drugs to make lots and lots of money)</p>";
  107. echo "<p><a href=\"$PHP_SELF?action=login\">login</a> | ";
  108. if (strtolower($HTTP_ACCEPT_LANGUAGE) == "nl") {
  109. echo "<a href=\"185NL.html\" target=\"_blank\">instructions</a> | ";
  110. } else {
  111. echo "<a href=\"185EN.html\" target=\"_blank\">instructions</a> | ";
  112. }
  113. echo "<a href=\"$PHP_SELF?action=hiscore\">high scores</a> | ";
  114. echo "<a href=\"185info.html\">info</a></p>";
  115. echo "</body></html>";
  116. }
  117. }


en dan komt er niks te staan heeft iemand toevallig een idee waarom? diegene ben ik hardstikke dankbaar^^

edit:iemand plz?!?!
Gesponsorde links
Dit onderwerp is gesloten.
Actieve forumberichten
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.198s