Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am new to PHP and I am using PHP Version 5.4.17 in my mac. Below code with space gives me error. Once I remove the space in echo command, it gives me output but appended with Junk character. What am I doing wrong? Any help is appreciated
Code:
<?php
echo “Connection Success”;
?>
Error:
"Parse error: parse error, expecting ','' or';'' in /Library/WebServer/Documents/test org.php on line 2"
Code:
<?php
echo “ConnectionSuccess”;
?>
Output:
“ConnectionSuccessâ€
<?php
echo "ConnectionSuccess";
?>
You need to remove the bad quotes “ and ” and replace them with standard quotes: "
Some editors do this for you automatically, like BareBones.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
My PHP code dosnt seem to be working and I dont Know Why when Ever I Use this code it will Make The whole webpage appear white.I think the problem is Here Somewhereecho Hello, (.$_SESSION['username'], ENT_QUOTES, 'UTF-8');Thanks In Advance
session_start();
if(!isset($_SESSION['user']) && empty($_SESSION['user'])) {
echo '<b>Log In</b>';
}
else {
echo Hello, (.$_SESSION['username'], ENT_QUOTES, 'UTF-8');
echo '</br></b>';
echo '<b>Log Out</b>';
}
When your page goes white, it usually means you have a fatal error in your code and need to check your logs, or turn on error_reporting.
In this case you're missing quotes, have the concatenation a bit messed up, and appear to be missing a function call (probably htmlspecialchars).
Also, you're checking $_SESSION['user'] a few lines before in your code, are you sure you don't mean to echo that here instead of $_SESSION['username']?
I think you want to change that line to:
echo "Hello, " . htmlspecialchars($_SESSION['user'], ENT_QUOTES, 'UTF-8');
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Parse error: syntax error, unexpected T_IS_IDENTICAL in /home/vvcoutur/public_html/wp-content/themes/stoconverge/header.php on line 54
This is line 54:
<?php ======= COOKIE DEMO OPTIONS ======= //wp_enqueue_style('skins', get_template_directory_uri(). '/admin/layouts/' . $data['alt_stylesheet'] ); ?>
What am i getting wrong
======= COOKIE DEMO OPTIONS =======
should be a comment it isn't and your code is commented out. Try this :
<?php /**======= COOKIE DEMO OPTIONS =======**/ wp_enqueue_style('skins', get_template_directory_uri(). '/admin/layouts/' . $data['alt_stylesheet'] ); ?>
With better formatting and using an IDE you would have seen this easily.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Need a hand..i am getting following error :
Parse error: syntax error, unexpected '<' in C:\xampp\htdocs\site\html_purple\design_your_own_card.php on line 213
while line number 213 is :
<?php <img id='image1' src='http://localhost/uploader/".$fulltarget."' width='280px' height='180px'/> ?>
You are mixing php and HTML.
Try this..
<?php echo "<img id='image1' src='http://localhost/uploader/".$fulltarget."' width='280px' height='180px'/>"; ?>
OR just wrap your php variables in php tags..
<img id='image1' src='http://localhost/uploader/<?= $fulltarget ?>' width='280px' height='180px'/>
You cant wrap html in php, you need to echo or print it out
<?php print "<img id='image1' src='http://localhost/uploader/".$fulltarget."' width='280px' height='180px'/>"; ?>
OR
<?php echo "<img id='image1' src='http://localhost/uploader/".$fulltarget."' width='280px' height='180px'/>"; ?>
You have html wrapped in PHP.
Try
echo "<html code>";
Or my personal favourite. Only wrap your variables in php tags.
<img id='image1' src='http://localhost/uploader/"<? echo $fulltarget; ?> width='280px' height='180px'/>
This will only work with short tags enabled in config.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Can anyone tell me what is wrong with the below shorthand if/else code?
<div class="holder <?php echo (!empty($bid_info['sale_price'] ? 'holder7' : 'holder4'); ?>">
According to this page it seems right!?
Though I am getting the below error:
Parse error: syntax error, unexpected '?', expecting ')' in ...........
Missing ) before the ?
<?php echo (!empty($bid_info['sale_price']) ? 'holder7' : 'holder4'); ?>
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
The simple program is not returning the string,Please help.
<?php
function returnStr() {
return "fooBar";
}
$str=returnStr();
echo $str;
}
?>
It's a parse error:
$str=returnStr();
echo $str;
} // WHAT IS THIS BRACKET DOING HERE?
There's a fatal error tokenizing the code due the trailing/unmatched '}' remove that and the code will work. Then spend some time thinking about why you didn't know this already
There's an error in your code. The last } is useless.