mysql klopt niet
Zerato0 - 09/07/2005 19:26
Onbekend
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
MothZone - 09/07/2005 19:28
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
Zerato0 - 09/07/2005 19:33
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
Tuinstoel - 09/07/2005 19:42
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.
Zerato0 - 09/07/2005 19:43 (laatste wijziging 09/07/2005 22:53)
Onbekend
dat van postresql is opgelost maar kijk ik heb nou het volgende:
<?php
if (!$player || $logout) {
$uid = "";
$player = "";
switch ($action) {
case "login":
$name = trim(str_replace(",", " ", substr($name,0,20)));
$password = trim(substr($password,0,15));
if (addslashes($name) != $name || (strstr($name, " ") && $new)) {
$error = "Invalid characters in username.";
} else if (addslashes($password) != $password) {
$error = "Invalid characters in password.";
} else if ($name != "" && $password != "") {
$language=$lang;
$lname = strtolower($name);
$qry = "select * from dopewars where lower(name) = '$lname';";
$result = $db->qry($qry);
if ($new) {
if ($result != array()) {
$error = "There already exists a user named \"$name\".";
} else {
check_max();
$player["name"] = $name;
$player["cash"] = 5000;
$player["debt"] = 4761;
$player["bank"] = 0;
$player["guns"] = 0;
$player["bitches"] = 2;
$player["space"] = 20 + $player["bitches"] * 10;
$player["held"] = 0;
$player["life"] = 100;
$player["guns"] = array();
$player["drugs"] = array();
$player["drugprices"] = array();
$player["prices"] = array();
$player["destination"] = 1;
$player["snitches"] = array();
$player["currentsnitches"] = array();
$player["snitchreport"] = array();
$player["fighthistory"] = array();
$pl = addslashes(serialize($player));
$qry = "insert into dopewars (name, password, score, player) values ('$name', '$password', 0, '$pl');";
$result = $db->qry($qry);
$uid = $name;
}
} else {
if ($result == array()) {
$error = "No such user";
} else if ($result[0]["password"] != $password) {
$error = "Invalid password";
} else {
check_max();
$uid = addslashes($result[0]["name"]);
}
}
}
if (!$uid) {
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">";
echo "<html><head><title>dopewars</title><link rel=\"stylesheet\" href=\"default.css\" type=\"text/css\"></head><body><h3>dopewars - login</h3>";
echo "<div style=\"height:20px;margin-top:30px;\">";
if ($error) {
echo "<p>$error</p>";
}
echo "</div>";
echo "<form action=\"$PHP_SELF\" method=\"POST\">";
echo "<p>name: ";
echo "<input name=\"name\" type=\"text\" value=\"\" class=\"button\" size=\"10\" maxlength=\"20\"></p>";
echo "<p>password: ";
echo "<input name=\"password\" type=\"password\" value=\"\" class=\"button\" size=\"10\" maxlength=\"15\"></p>";
echo "<p>language: ";
echo "<select name=\"lang\" class=\"button\"><option value=\"EN\">English</option>";
if (strtolower($HTTP_ACCEPT_LANGUAGE) == "nl") {
echo "<option value=\"NL\" selected>Nederlands</option>";
} else {
echo "<option value=\"NL\">Nederlands</option>";
}
echo "</select></p>";
if ($new) {
echo "<p><input name=\"new\" type=\"checkbox\" checked> <label for=\"new\">create new account</label></p>";
} else {
echo "<p><input name=\"new\" type=\"checkbox\"> <label for=\"new\">create new account</label></p>";
}
echo "<input name=\"action\" type=\"hidden\" value=\"login\">";
echo "<input type=\"submit\" value=\"login\" class=\"button\"> ";
echo "</form>";
echo "</body></html>";
exit;
}
break;
default:
// genereric script to check for drunkmenworkhere editions
// comment out next two lines, they're only useful on drunkmenworkhere.org
@include("editions.php");
@checkEdition();
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">";
echo "<html><head><title>dopewars</title><link rel=\"stylesheet\" href=\"default.css\" type=\"text/css\"></head><body>";
echo "<h2>dopewars</h2>";
echo "<p>(deal drugs to make lots and lots of money)</p>";
echo "<p><a href=\"$PHP_SELF?action=login\">login</a> | ";
if (strtolower($HTTP_ACCEPT_LANGUAGE) == "nl") {
echo "<a href=\"185NL.html\" target=\"_blank\">instructions</a> | ";
} else {
echo "<a href=\"185EN.html\" target=\"_blank\">instructions</a> | ";
}
echo "<a href=\"$PHP_SELF?action=hiscore\">high scores</a> | ";
echo "<a href=\"185info.html\">info</a></p>";
echo "</body></html>";
exit;
}
}
<?php
if ( ! $player || $logout ) {
$uid = "" ;
$player = "" ;
switch ( $action ) {
case "login" :
$error = "Invalid characters in username." ;
$error = "Invalid characters in password." ;
} else if ( $name != "" && $password != "" ) {
$language = $lang ;
$qry = "select * from dopewars where lower(name) = '$lname ';" ;
$result = $db -> qry ( $qry ) ;
if ( $new ) {
if ( $result != array ( ) ) { $error = "There already exists a user named \" $name \" ." ;
} else {
check_max( ) ;
$player [ "name" ] = $name ;
$player [ "cash" ] = 5000 ;
$player [ "debt" ] = 4761 ;
$player [ "bank" ] = 0 ;
$player [ "guns" ] = 0 ;
$player [ "bitches" ] = 2 ;
$player [ "space" ] = 20 + $player [ "bitches" ] * 10 ;
$player [ "held" ] = 0 ;
$player [ "life" ] = 100 ;
$player [ "guns" ] = array ( ) ; $player [ "drugs" ] = array ( ) ; $player [ "drugprices" ] = array ( ) ; $player [ "prices" ] = array ( ) ; $player [ "destination" ] = 1 ;
$player [ "snitches" ] = array ( ) ; $player [ "currentsnitches" ] = array ( ) ; $player [ "snitchreport" ] = array ( ) ; $player [ "fighthistory" ] = array ( ) ;
$qry = "insert into dopewars (name, password, score, player) values ('$name ', '$password ', 0, '$pl ');" ;
$result = $db -> qry ( $qry ) ;
$uid = $name ;
}
} else {
if ( $result == array ( ) ) { $error = "No such user" ;
} else if ( $result [ 0 ] [ "password" ] != $password ) {
$error = "Invalid password" ;
} else {
check_max( ) ;
}
}
}
if ( ! $uid ) {
echo "<!DOCTYPE HTML PUBLIC \" -//W3C//DTD HTML 4.01 Transitional//EN\" \" http://www.w3.org/TR/html4/loose.dtd\" >" ; echo "<html><head><title>dopewars</title><link rel=\" stylesheet\" href=\" default.css\" type=\" text/css\" ></head><body><h3>dopewars - login</h3>" ; echo "<div style=\" height:20px;margin-top:30px;\" >" ; if ( $error ) {
}
echo "<form action=\" $PHP_SELF \" method=\" POST\" >" ; echo "<input name=\" name\" type=\" text\" value=\" \" class=\" button\" size=\" 10\" maxlength=\" 20\" ></p>" ; echo "<input name=\" password\" type=\" password\" value=\" \" class=\" button\" size=\" 10\" maxlength=\" 15\" ></p>" ; echo "<select name=\" lang\" class=\" button\" ><option value=\" EN\" >English</option>" ; echo "<option value=\" NL\" selected>Nederlands</option>" ; } else {
echo "<option value=\" NL\" >Nederlands</option>" ; }
if ( $new ) {
echo "<p><input name=\" new\" type=\" checkbox\" checked> <label for=\" new\" >create new account</label></p>" ; } else {
echo "<p><input name=\" new\" type=\" checkbox\" > <label for=\" new\" >create new account</label></p>" ; }
echo "<input name=\" action\" type=\" hidden\" value=\" login\" >" ; echo "<input type=\" submit\" value=\" login\" class=\" button\" > " ; }
break ;
default :
// genereric script to check for drunkmenworkhere editions
// comment out next two lines, they're only useful on drunkmenworkhere.org
@ include ( "editions.php" ) ;
@ checkEdition( ) ;
echo "<!DOCTYPE HTML PUBLIC \" -//W3C//DTD HTML 4.01 Transitional//EN\" \" http://www.w3.org/TR/html4/loose.dtd\" >" ; echo "<html><head><title>dopewars</title><link rel=\" stylesheet\" href=\" default.css\" type=\" text/css\" ></head><body>" ; echo "<h2>dopewars</h2>" ; echo "<p>(deal drugs to make lots and lots of money)</p>" ; echo "<p><a href=\" $PHP_SELF ?action=login\" >login</a> | " ; echo "<a href=\" 185NL.html\" target=\" _blank\" >instructions</a> | " ; } else {
echo "<a href=\" 185EN.html\" target=\" _blank\" >instructions</a> | " ; }
echo "<a href=\" $PHP_SELF ?action=hiscore\" >high scores</a> | " ; echo "<a href=\" 185info.html\" >info</a></p>" ; }
}
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 .