Page 1 of 2

Parse error: syntax error, unexpected T_STRING in line 66

Posted: Sat Dec 30, 2006 3:08 pm
by Elite
$out = '<input name="mass_action" type="submit" value="'."{"Move"}".'" class="button"> '."{"to"}".': <select name="move_to">';

Posted: Sat Dec 30, 2006 3:09 pm
by Elite
i cant seem to find the parse error im sure its simple

Posted: Sat Dec 30, 2006 3:12 pm
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?

Posted: Sat Dec 30, 2006 3:14 pm
by arukomp
try this:

Code: Select all

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

Posted: Sat Dec 30, 2006 3:14 pm
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>";

Posted: Sat Dec 30, 2006 3:15 pm
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>

Posted: Sat Dec 30, 2006 3:19 pm
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 :)

Posted: Sat Dec 30, 2006 3:21 pm
by Elite
ok ill do that now why would those quotes cause that im just learning hehe

Posted: Sat Dec 30, 2006 3:23 pm
by Elite
nope still says line 102

Posted: Sat Dec 30, 2006 3:26 pm
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">';

Posted: Sat Dec 30, 2006 3:30 pm
by Elite
now it says line 102

Posted: Sat Dec 30, 2006 3:32 pm
by Elite
/*$out = '<input name="mass_action" type="submit" value="'."{"Move"}".'" class="button"> '."{"to"}".': <select name="move_to">';*/




did i do this right?

Posted: Sat Dec 30, 2006 3:46 pm
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

Posted: Sat Dec 30, 2006 4:06 pm
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.

Posted: Sat Dec 30, 2006 4:08 pm
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">';