endar Posted June 24, 2007 Share Posted June 24, 2007 $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. =) Quote Link to comment https://forums.phpfreaks.com/topic/56941-help-whitespace-error/ Share on other sites More sharing options...
.Stealth Posted June 24, 2007 Share Posted June 24, 2007 It is most likey to be the fact you used the $_POST vars within the statement. Before you call this, set all values into normal variables e.g: $entry = $_POST['txtEntry']; Quote Link to comment https://forums.phpfreaks.com/topic/56941-help-whitespace-error/#findComment-281265 Share on other sites More sharing options...
bubblegum.anarchy Posted June 24, 2007 Share Posted June 24, 2007 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'])."' )"; Quote Link to comment https://forums.phpfreaks.com/topic/56941-help-whitespace-error/#findComment-281281 Share on other sites More sharing options...
endar Posted June 24, 2007 Author Share Posted June 24, 2007 Sorry stealth but your way didn't work, thankfully bubble's did. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/56941-help-whitespace-error/#findComment-281284 Share on other sites More sharing options...
.Stealth Posted June 24, 2007 Share Posted June 24, 2007 Must've been what was in the values. I normally get whitespace errors when i use $_POST etc within things like the above. At least its sorted now Quote Link to comment https://forums.phpfreaks.com/topic/56941-help-whitespace-error/#findComment-281285 Share on other sites More sharing options...
Wildbug Posted June 24, 2007 Share Posted June 24, 2007 If you want array elements to be interpolated in a double quoted string, remove the quotes around the index: <?php echo "Like this: $_POST[something]"; ?> whereas you'd normally use $_POST['something'] outside of the quotes. Quote Link to comment https://forums.phpfreaks.com/topic/56941-help-whitespace-error/#findComment-281292 Share on other sites More sharing options...
Illusion Posted June 25, 2007 Share Posted June 25, 2007 Might, the problem is you are missing 'VALUES' key word in the INSERT statement. Quote Link to comment https://forums.phpfreaks.com/topic/56941-help-whitespace-error/#findComment-281903 Share on other sites More sharing options...
Wildbug Posted June 25, 2007 Share Posted June 25, 2007 VALUES is there; it's just a really long list of columns. Quote Link to comment https://forums.phpfreaks.com/topic/56941-help-whitespace-error/#findComment-281954 Share on other sites More sharing options...
Illusion Posted June 25, 2007 Share Posted June 25, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/56941-help-whitespace-error/#findComment-281973 Share on other sites More sharing options...
fenway Posted June 27, 2007 Share Posted June 27, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/56941-help-whitespace-error/#findComment-284302 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.