Parse error: syntax error, unexpected '{' [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
Tried a few things, I am sure this is a minor error but I have been staring at it for ages!
if (isset ($_GET['id']) { $product_id = strip_tags($_GET['id']); }
Can anyone see what is wrong?

You're missing a ):
if (isset ($_GET['id'])) { $product_id = strip_tags($_GET['id']); }
^

you are missing first started small bracket.
(isset ($_GET['id']) -- here ) should be closed like.
if (isset ($_GET['id'])) { $product_id = strip_tags($_GET['id']); }

Related

Assign empty string to php variable [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
Just need help fixing this php code
if ($cmtx_set_name_value == "anonymous")
{
$cmtx_set_name_value = ""
}
thanks
Try adding ; after the assignment.
$cmtx_set_name_value = "";
your code is work fine just put ; to end of line
if ($cmtx_set_name_value == "anonymous"){
$cmtx_set_name_value = "" ; }

How do I negate this if/else comparison to just if? [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'm trying to set the class hidden, unless two factors are met. Currently, I'm using the code below:
<?php
if (isset($_POST['prerequisite']) && $form == "CheckingIn")
{
}
else
{
echo "hidden";
}
?>
How can I fix this to just be an if statement instead of an if/else?
Negate the expression; use the "NOT" logical operator:
if (!(isset($_POST['prerequisite']) && $form == "CheckingIn")) { echo "hidden"; }
(notice the ! symbol)
Read more here: http://php.net/manual/en/language.operators.logical.php

Getting syntax error when using shorthand if/else code [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
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'); ?>

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