Jump to content

HELP! Whitespace error!


endar

Recommended Posts

$query = "INSERT INTO `creature_template` (`entry`, `modelid_m`, `modelid_f`, `name`, `subname`, `minlevel`, `maxlevel`, `minhealth`, `maxhealth`, `minmana`, `maxmana`, `armor`, `faction`, `npcflag`, `speed`, `rank`, `mindmg`, `maxdmg`, `attackpower`, `baseattacktime`, `rangeattacktime`, `flags`, `dynamicflags`, `size`, `family`, `bounding_radius`, `trainer_type`, `trainer_spell`, `class`, `race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `combat_reach`, `type`, `civilian`, `flag1`, `equipmodel1`, `equipmodel2`, `equipmodel3`, `equipinfo1`, `equipinfo2`, `equipinfo3`, `equipslot1`, `equipslot2`, `equipslot3`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `ScriptName`) VALUES (($_POST['txtEntry']), ($_POST['txtmodelid_m']), ($_POST['txtmodelid_f']), ($_POST['txtname']), ($_POST['txtsubname']), ($_POST['txtminlevel']), ($_POST['txtmaxlevel']), ($_POST['txtminhealth']), ($_POST['txtmaxhealth']), ($_POST['txtminmana']), ($_POST['txtmaxmana']), ($_POST['txtarmor']), ($_POST['txtfaction']), ($_POST['txtnpcflag']), ($_POST['txtspeed']), ($_POST['txtrank']), ($_POST['txtmindmg']), ($_POST['txtmaxdmg']), ($_POST['txtattackpower']), ($_POST['txtbaseattacktime']), ($_POST['txtrangeattacktime']), ($_POST['txtflags']), ($_POST['txtdynamicflags']), ($_POST['txtsize']), ($_POST['txtfamily']), ($_POST['txtbounding_radius']), ($_POST['txttrainer_type']), ($_POST['txttrainer_spell']), ($_POST['txtclass']), ($_POST['txtrace']), ($_POST['txtminrangedmg']), ($_POST['txtmaxrangedmg']), ($_POST['txtrangedattackpower']), ($_POST['txtcombat_reach']), ($_POST['txttype']), ($_POST['txtcivilian']), ($_POST['txtflag1']), ($_POST['txtequipmodel1']), ($_POST['txtequipmodel2']), ($_POST['txtequipmodel3']), ($_POST['txtequipinfo1']), ($_POST['txtequipinfo2']), ($_POST['txtequipinfo3']), ($_POST['txtequipslot1']), ($_POST['txtequipslot2']), ($_POST['txtequipslot3']), ($_POST['txtlootid']), ($_POST['txtpickpocketloot']), ($_POST['txtskinloot']), ($_POST['txtresistance1']), ($_POST['txtresistance2']), ($_POST['txtresistance3']), ($_POST['txtresistance4']), ($_POST['txtresistance5']), ($_POST['txtresistance6']), ($_POST['txtspell1']), ($_POST['txtspell2']), ($_POST['txtspell3']), ($_POST['txtspell4']), ($_POST['txtmingold']), ($_POST['txtmaxgold']), ($_POST['txtAIName']), ($_POST['txtMovementType']), ($_POST['txtInhabitType']), ($_POST['txtScriptName'])";

That's my query, here's the error I get:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Documents and Settings\ben\Desktop\xampplite\htdocs\createnpc.php on line 119

I figured out it's starting near VALUES, so any help is appreciated. =)

Link to comment
Share on other sites

Try something like this:

 

$query = "
INSERT INTO`creature_template` 
(
	`entry`,
	`modelid_m`,
	`modelid_f`,
	`name`,
	`subname`,
	`minlevel`,
	`maxlevel`,
	`minhealth`,
	`maxhealth`,
	`minmana`,
	`maxmana`,
	`armor`,
	`faction`,
	`npcflag`,
	`speed`,
	`rank`,
	`mindmg`,
	`maxdmg`,
	`attackpower`,
	`baseattacktime`,
	`rangeattacktime`,
	`flags`,
	`dynamicflags`,
	`size`,
	`family`,
	`bounding_radius`,
	`trainer_type`,
	`trainer_spell`,
	`class`,
	`race`,
	`minrangedmg`,
	`maxrangedmg`,
	`rangedattackpower`,
	`combat_reach`,
	`type`,
	`civilian`,
	`flag1`,
	`equipmodel1`,
	`equipmodel2`,
	`equipmodel3`,
	`equipinfo1`,
	`equipinfo2`,
	`equipinfo3`,
	`equipslot1`,
	`equipslot2`,
	`equipslot3`,
	`lootid`,
	`pickpocketloot`,
	`skinloot`,
	`resistance1`,
	`resistance2`,
	`resistance3`,
	`resistance4`,
	`resistance5`,
	`resistance6`,
	`spell1`,
	`spell2`,
	`spell3`,
	`spell4`,
	`mingold`,
	`maxgold`,
	`AIName`,
	`MovementType`,
	`InhabitType`,
	`ScriptName`
) 
VALUES 
(
	'".mysql_real_escape_string($_POST['txtEntry'])."',
	'".mysql_real_escape_string($_POST['txtmodelid_m'])."',
	'".mysql_real_escape_string($_POST['txtmodelid_f'])."',
	'".mysql_real_escape_string($_POST['txtname'])."',
	'".mysql_real_escape_string($_POST['txtsubname'])."',
	'".mysql_real_escape_string($_POST['txtminlevel'])."',
	'".mysql_real_escape_string($_POST['txtmaxlevel'])."',
	'".mysql_real_escape_string($_POST['txtminhealth'])."',
	'".mysql_real_escape_string($_POST['txtmaxhealth'])."',
	'".mysql_real_escape_string($_POST['txtminmana'])."',
	'".mysql_real_escape_string($_POST['txtmaxmana'])."',
	'".mysql_real_escape_string($_POST['txtarmor'])."',
	'".mysql_real_escape_string($_POST['txtfaction'])."',
	'".mysql_real_escape_string($_POST['txtnpcflag'])."',
	'".mysql_real_escape_string($_POST['txtspeed'])."',
	'".mysql_real_escape_string($_POST['txtrank'])."',
	'".mysql_real_escape_string($_POST['txtmindmg'])."',
	'".mysql_real_escape_string($_POST['txtmaxdmg'])."',
	'".mysql_real_escape_string($_POST['txtattackpower'])."',
	'".mysql_real_escape_string($_POST['txtbaseattacktime'])."',
	'".mysql_real_escape_string($_POST['txtrangeattacktime'])."',
	'".mysql_real_escape_string($_POST['txtflags'])."',
	'".mysql_real_escape_string($_POST['txtdynamicflags'])."',
	'".mysql_real_escape_string($_POST['txtsize'])."',
	'".mysql_real_escape_string($_POST['txtfamily'])."',
	'".mysql_real_escape_string($_POST['txtbounding_radius'])."',
	'".mysql_real_escape_string($_POST['txttrainer_type'])."',
	'".mysql_real_escape_string($_POST['txttrainer_spell'])."',
	'".mysql_real_escape_string($_POST['txtclass'])."',
	'".mysql_real_escape_string($_POST['txtrace'])."',
	'".mysql_real_escape_string($_POST['txtminrangedmg'])."',
	'".mysql_real_escape_string($_POST['txtmaxrangedmg'])."',
	'".mysql_real_escape_string($_POST['txtrangedattackpower'])."',
	'".mysql_real_escape_string($_POST['txtcombat_reach'])."',
	'".mysql_real_escape_string($_POST['txttype'])."',
	'".mysql_real_escape_string($_POST['txtcivilian'])."',
	'".mysql_real_escape_string($_POST['txtflag1'])."',
	'".mysql_real_escape_string($_POST['txtequipmodel1'])."',
	'".mysql_real_escape_string($_POST['txtequipmodel2'])."',
	'".mysql_real_escape_string($_POST['txtequipmodel3'])."',
	'".mysql_real_escape_string($_POST['txtequipinfo1'])."',
	'".mysql_real_escape_string($_POST['txtequipinfo2'])."',
	'".mysql_real_escape_string($_POST['txtequipinfo3'])."',
	'".mysql_real_escape_string($_POST['txtequipslot1'])."',
	'".mysql_real_escape_string($_POST['txtequipslot2'])."',
	'".mysql_real_escape_string($_POST['txtequipslot3'])."',
	'".mysql_real_escape_string($_POST['txtlootid'])."',
	'".mysql_real_escape_string($_POST['txtpickpocketloot'])."',
	'".mysql_real_escape_string($_POST['txtskinloot'])."',
	'".mysql_real_escape_string($_POST['txtresistance1'])."',
	'".mysql_real_escape_string($_POST['txtresistance2'])."',
	'".mysql_real_escape_string($_POST['txtresistance3'])."',
	'".mysql_real_escape_string($_POST['txtresistance4'])."',
	'".mysql_real_escape_string($_POST['txtresistance5'])."',
	'".mysql_real_escape_string($_POST['txtresistance6'])."',
	'".mysql_real_escape_string($_POST['txtspell1'])."',
	'".mysql_real_escape_string($_POST['txtspell2'])."',
	'".mysql_real_escape_string($_POST['txtspell3'])."',
	'".mysql_real_escape_string($_POST['txtspell4'])."',
	'".mysql_real_escape_string($_POST['txtmingold'])."',
	'".mysql_real_escape_string($_POST['txtmaxgold'])."',
	'".mysql_real_escape_string($_POST['txtAIName'])."',
	'".mysql_real_escape_string($_POST['txtMovementType'])."',
	'".mysql_real_escape_string($_POST['txtInhabitType'])."',
	'".mysql_real_escape_string($_POST['txtScriptName'])."'
)";

Link to comment
Share on other sites

I have seen several posts in the forum , why people use single quotes over the table names and columns , unless it is a php variable to be interpreted or a string or date data type.

 

They're not single quotes, they're backticks.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.