Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
PHP Parse error: syntax error, unexpected T_OBJECT_OPERATOR in ...
tpl->set( '[complaint]', "<a href=\"javascript:AddComplaint('" . $row['id'] . "', 'comments')\">" );
What in this code causing problem, please help to find answer.
You're missing the dollar sign before your variable name:
tpl->set( '[complaint]', "<a href=\"javascript:AddComplaint('" . $row['id'] . "', 'comments')\">" );
should be:
$tpl->set( '[complaint]', "<a href=\"javascript:AddComplaint('" . $row['id'] . "', 'comments')\">" );
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
Can anyone help me for this why doesn't my code work?
$h.= ' 'mysql_result($res,$z,"name")'';
It gives me an error because of the <a href
$h .= ''.mysql_result($res,$z,"name").'';
Should work now
. before mysql_result and after.
Also take a look here it will help you to understand String Operators and etc.
You need to concatenate.
$h.= ' ' . mysql_result($res,$z,"name") . '';
Anyway, I would suggest you to put mysql_result($res,$z,"name") into a variable, to increase readability and avoid executing the function every time you call it.
I mean:
$name = mysql_result($res,$z,"name");
$h.= ' ' . $name . '';
Try this
$h.= ''.mysql_result($res,$z,"name").'';
You are missing . the concatenation operator
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
I can not color the $_SESSION['username'] while echo in php.
echo "Welcome, " .$_SESSION['username']."! "; //this code is running
echo '<span style="color:#AFA;text-align:center;">Welcome,'$_SESSION['username'];'</span>'; // this part is not working...
Please help me if you can
You forgot the concatenation ..
echo '<span style="color:#AFA;text-align:center;">Welcome,' . $_SESSION['username'] . '</span>'; // this part is not working...
Notice the missing . before and after $_SESSION['username'];
echo'<span style="color:#AFA;text-align:center;">Welcome,'.$_SESSION['username'].'</span>';
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
Is there something wrong with the line beginning with echo? I'm getting this error but I'm not sure how I can change it: Parse error: syntax error, unexpected '.' on line 74
while ( have_rows('stills') ) : the_row();
// display a sub field value
echo '<li><img src="' . the_sub_field('still'); . '" alt="<?php the_sub_field('project_name'); ?>-still"></li>'
endwhile;
I changed it to this but it's still not outputting correctly: echo '<li><img src="' . the_sub_field('still') . '"></li>';
Also, if this isn't the area to ask for help on these types of questions, where can I ask?
Edit: Tried satyr607's solution and this is how it's outputted.
<div class="project-stills">
<h3>Stills</h3>
http://localhost/wordpress/wp-content/uploads/2014/12/17.jpg
<li><img src="" alt="-still"></li>
</div>
Try this:
echo '<li><img src="' . the_sub_field('still') . '" alt="' . the_sub_field('project_name') . '-still"></li>';
watch your escaping.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
Hi I am getting this error and it has become a headache for me. Can anyone please help me where I have committed mistake.
Here is my code.
<?php echo mxp_draw_pull_down_menu('datefield', MxpStatistics::getFieldsDropDown(), isset($_SESSION['statistics']['datefield']) ? $_SESSION['statistics']['datefield'] : ' ', 'onchange="javascript: saveModify(document.searchreport'.$rand.', \''.mxp_href_link_admin(FILENAME_DEFAULT, $MxpTemplate->getModule() . '&module=' . substr($file['name'], 0, strrpos($file['name'], '.'))) ."' , null, " . $_GET['windowId']);"');?>
Just remove last four characters("');) from your code.
You can detect you syntax errors easily, if you use any syntax highlighting IDE.
Also, if you try to save number of line like this, it will be a real headache for you to find syntax errors and debug.
Try this code
<?php
echo mxp_draw_pull_down_menu('datefield', MxpStatistics::getFieldsDropDown(), isset($_SESSION['statistics']['datefield']) ? $_SESSION['statistics']['datefield'] : ' ', 'onchange="javascript: saveModify(document.searchreport'.$rand.', \''.mxp_href_link_admin(FILENAME_DEFAULT, $MxpTemplate->getModule() . '&module=' . substr($file['name'], 0, strrpos($file['name'], '.'))) ."' , null, " . $_GET['windowId']);
?>
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 9 years ago.
Improve this question
how can I print out a variable name in text in php?
I want to accomplish something as simple as having this:
echo "|" . "$myvariable" . "|";
print out this:
|$myvariable|
instead of this:
||
how can I accomplish this?
Use single quotes so that the variables don't get interpolated:
echo "|" . '$myvariable' . "|";
As others pointed out, use single quotes to show the variable name "as is".
echo "|" . '$myvariable' . "|";
Be sure to read this part of the manual.