Page 1 of 1
[SOLVED]unexpected T_ENCAPSED_AND_WHITESPACE
Posted: Tue Dec 30, 2003 3:03 pm
by Straterra
I am getting the following error : Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in c:\ftp\users\straterra\eck\cgi-bin\full1.php on line 53
Now, this is line 53 :
Code: Select all
sqlite_query($db, "insert into clanprofile2 (firstname, lastname, middleinit, birthyear, socomname, socommap, sealswep, terrwep, website, hometown, picture, gender, birthday, occupation, bands, tvshows, movies, bgcolor, textcolor, picorcolor, music) values ($result['firstname'], $result['middleinit'], $result['lastname'], $result['birthyear'], '$user', $result['socommap'], $result['sealswep'], $result['terrwep'], $result['website'], $result['hometown'], $result['picture'], $result['birthday'], $result['gender'], $result['occupation'], $result['bands'], $result['tvshows'], $result['movies'], 'white', 'black', 'color', 'none')");
Posted: Tue Dec 30, 2003 3:17 pm
by microthick
You need to quote all of those strings.
'$result['birthyear']' ... etc.
Posted: Tue Dec 30, 2003 3:23 pm
by Straterra
I did that..same error.
Posted: Tue Dec 30, 2003 3:28 pm
by microthick
What does it look like now?
Posted: Tue Dec 30, 2003 3:38 pm
by Straterra
Code: Select all
sqlite_query($db, "insert into clanprofile2 (firstname, lastname, middleinit, birthyear, socomname, socommap, sealswep, terrwep, website, hometown, picture, gender, birthday, occupation, bands, tvshows, movies, bgcolor, textcolor, picorcolor, music) values ('$result['firstname']', '$result['middleinit']', '$result['lastname']', '$result['birthyear']', '$user', '$result['socommap']', '$result['sealswep']', '$result['terrwep']', '$result['website']', '$result['hometown']', '$result['picture']', '$result['birthday']', '$result['gender']', '$result['occupation']', '$result['bands']', '$result['tvshows']', '$result['movies']', 'white', 'black', 'color', 'none')");
Posted: Tue Dec 30, 2003 3:54 pm
by microthick
Yeah, those inner single quotes are gonna cause some major problems...
Two things you can do:
Bad, but easy way:
sqlite_query($db, "insert into clanprofile2 (firstname, lastname, middleinit, birthyear, socomname, socommap, sealswep, terrwep, website, hometown, picture, gender, birthday, occupation, bands, tvshows, movies, bgcolor, textcolor, picorcolor, music) values ('$result[firstname]', '$result[middleinit]', '$result[lastname]', '$result[birthyear]', '$user', '$result[socommap]', '$result[sealswep]', '$result[terrwep]', '$result[website]', '$result[hometown]', '$result[picture]', '$result['birthday]', '$result[gender]', '$result[occupation]', '$result[bands]', '$result[tvshows]', '$result[movies]', 'white', 'black', 'color', 'none')");
I think I got them all.
Good, but longer way:
Concatenate strings to create the query.
Like you'd go
" .. stuf stuf stuff, ".$result['firstname'].", ".$result['lastname']." stuf stuf stuf";
Posted: Tue Dec 30, 2003 4:04 pm
by Straterra
The bad, easy way doesn't work. What I am going to do is assign each of those into variables, and it should be MUCH easer, don't ya think?
Posted: Tue Dec 30, 2003 4:07 pm
by microthick
Straterra wrote:The bad, easy way doesn't work. What I am going to do is assign each of those into variables, and it should be MUCH easer, don't ya think?
Yeah.