Skynox
Authorized Bartender
I'm making a script so that administrators can create characters and put them in
another players account.
The PHP code
I got some problems executing the INSERT into my database. I get this error
The error message. The line that the error seems to be is "$SQL->query"
Can someone please help.
another players account.
The PHP code
PHP:
$player = stripslashes(ucwords(strtolower(trim($_REQUEST['character']))));
$character = $_POST['character'];
$new_char = $_POST['new_char'];
if(empty($player)) {
$main_content .= '<center><h2><img src="'.$layout_name.'/images/content/headline-bracer-left.gif" /> CREATE CHARACTER <img src="'.$layout_name.'/images/content/headline-bracer-right.gif" /></h2><br><br>
<form action="" method="post">
<B>Character Name:</B><br><input type="textbox" name="character">
<br><br>
<B>New Character:</B><br><input type="textbox" name="new_char">
<br><br>
<input type="submit" value="Submit">
</form></center><form action="?subtopic=teammanager" method="post" ></form></center>';
}
else
{
$player_data = $SQL->query("SELECT * FROM `players` WHERE `name` = '".$player."';")->fetch();
$SQL->query("INSERT INTO `players` VALUES ( , $new_char, 0, 4, $player_data[account_id], 2, 0, 185, 185, 0, 44, 44, 44, 44, 128, 0, 0, 35, 35, 0, 100, 5, 0, 0, 0, , 420, 1, 0, 0, 1, 0, 0, 0, , 0, 0, 0, 151200000, 0, 0, 0, 0, 100, 100, 0, 0, 0, 0, 0, , 0, 0, , 0, , 0");
The error message. The line that the error seems to be is "$SQL->query"
Code:
[COLOR=silver]Exception information
Message received: [I]SQLSTATE[42000]: Syntax error or access violation: 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 ' Goliath, 0, 4, 4771118, 2, 0, 185, 185, 0, 44, 44, 44, 44, 128, 0, 0, 35, 35' at line 1[/I]
File: C:\xampp\htdocs\d\teammanager.php
On line: 109
Exception code: 42000
Current site
Error shown on: C:/xampp/htdocs/d/index.php
Requests
subtopic :: createcharacter
action :: createchar
character :: Thor
new_char :: Goliath
PHPSESSID :: vhckqd39na96rsuur53698h9n1
Last errors
type :: 8
message :: Undefined index: password_login
file :: C:\xampp\htdocs\d\index.php
line :: 42 [/COLOR]
Can someone please help.