Getting syntax error when using shorthand if/else code [closed] - php

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'); ?>

Related

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE in line 61 [closed]

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 seem to have an error in line the following line but i cant figure it out, i'm new at this:
<input type="submit" value="<?php _e( 'Download Export File', 'yit' ) ?>" class="button-secondary" id="export-file" />
Thanks
You forgot to put a semicolon here
<?php _e( 'Download Export File', 'yit' ); ?>
-----^

PHP echo with space and without space [closed]

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.

A php Error in site [closed]

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.

T_VARIABLE parse error [closed]

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 saw here about my problem PHP Script to Edit DNS Records in CPanel but When I try to use the dnsclass.php.
I can create a object like this:
$zones = new zone_records("cpaneluser", "pass", "website_to_login", "domain_of_records")
But I can't use this:
$zones->addrecord($type, $target, $name, $ttl)
I'm having this problem :
Parse error: syntax error, unexpected T_VARIABLE in /home/mcser325/public_html/test.php
My code:
include 'classdns.php';
$zones = new zone_records("**", "**", "**", "**")
$zones->addrecord("**", "**", "**", "**")
There is no semicolon at the end of the statement which is causing the error.

Php:Return a String from a function [closed]

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.

Categories