Parse error: syntax error, unexpected T_STRING in line 66

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Elite
Forum Newbie
Posts: 9
Joined: Sat Dec 30, 2006 3:06 pm

Parse error: syntax error, unexpected T_STRING in line 66

Post by Elite »

$out = '<input name="mass_action" type="submit" value="'."{"Move"}".'" class="button"> '."{"to"}".': <select name="move_to">';
Elite
Forum Newbie
Posts: 9
Joined: Sat Dec 30, 2006 3:06 pm

Post by Elite »

i cant seem to find the parse error im sure its simple
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

yes and no. It's simple to find but I can't figure what you're trying to achieve.
What's
Elite wrote:"{"Move"}"
supposed to do?
arukomp
Forum Contributor
Posts: 113
Joined: Sun Sep 24, 2006 4:22 am

Post by arukomp »

try this:

Code: Select all

$out = "<input name='mass_action' type='submit' value='"."{'Move'}"."' class='button'> "."{'to'}".": <select name='move_to'>";
Elite
Forum Newbie
Posts: 9
Joined: Sat Dec 30, 2006 3:06 pm

Post by Elite »

ok here ill send 5 lines so you can see a little better



}

else{


$out = '<input name="mass_action" type="submit" value="'."{"Move"}".'" class="button"> '."{"to"}".': <select name="move_to">'; <<<<<<<<<<<<<<that is line 66
$out .= "<option value=\"\">{}</option>";
while($res = $sql->fetch(MYSQL_ASSOC)){
$out .= "<option value=\"{$res['id']}\">{$res['name_en']}</option>";
Elite
Forum Newbie
Posts: 9
Joined: Sat Dec 30, 2006 3:06 pm

Post by Elite »

after doing that now it says line 102


<a href="index.php?page=edit_photo_upload&id='.$res['id'].'">'."{"Edit"}".'</a> | <a href="index.php?page=view_photo_album&album_id='.$id.'&action=do_delete&pid='.$res['id'].'">'."{"Delete"}".'</a><br>
arukomp
Forum Contributor
Posts: 113
Joined: Sun Sep 24, 2006 4:22 am

Post by arukomp »

Switch quotes. Use " instead of ' and ' instead of ". I think that's the problem. After I switched quotes, now 66 line is working great :)
Elite
Forum Newbie
Posts: 9
Joined: Sat Dec 30, 2006 3:06 pm

Post by Elite »

ok ill do that now why would those quotes cause that im just learning hehe
Elite
Forum Newbie
Posts: 9
Joined: Sat Dec 30, 2006 3:06 pm

Post by Elite »

nope still says line 102
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Code: Select all

$a = 'abc' . 'xyz';
echo $a, "<br />\n";
// you get the same result with
$a = '';
$a .= 'abc';
$a .= 'xyz';
echo $a, "<br />\n";
Now let's do the same with your string.

Code: Select all

/*
before:
 $out = "<input name='mass_action' type='submit' value='"."{'Move'}"."' class='button'> "."{'to'}".": <select name='move_to'>";
after:    */
$out = '';
$out = '<input name="mass_action" type="submit" value="';
$out .= "{"Move"}"; // <- see the problem here?
$out .= '" class="button"> ';
$out .= "{"to"}"; // <- and here?
$out .= ': <select name="move_to">';
Elite
Forum Newbie
Posts: 9
Joined: Sat Dec 30, 2006 3:06 pm

Post by Elite »

now it says line 102
Elite
Forum Newbie
Posts: 9
Joined: Sat Dec 30, 2006 3:06 pm

Post by Elite »

/*$out = '<input name="mass_action" type="submit" value="'."{"Move"}".'" class="button"> '."{"to"}".': <select name="move_to">';*/




did i do this right?
Elite
Forum Newbie
Posts: 9
Joined: Sat Dec 30, 2006 3:06 pm

Post by Elite »

/*
$out = "<input name='mass_action' type='submit' value='"."{'Move'}"."' class='button'> "."{'to'}".": <select name='move_to'>"; */
$out = '';
$out = '<input name="mass_action" type="submit" value="';
$out .= "{"Move"}";<<<<<<<<<<<<<<<<<<<<< there is line 70
$out .= '" class="button"> ';
$out .= "{"to"}";
$out .= ': <select name="move_to">';
$out .= "<option value=\"\">{}</option>";



is this how it should look now its saying line 70
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

/* */ marks a comment, it's not executed.
My question was about the line

Code: Select all

$out .= "{"Move"}";
If you begin a string literal with a double-quote it tesll php: the string literal ends right before the next (unescaped) doblue-quote
You have the string "}" followed by Move and php does not know what Move means.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

are Move and to variables? if so:

Code: Select all

$out = '<input name="mass_action" type="submit" value="'.$Move.'" class="button"> '.$to.': <select name="move_to">';
Post Reply