This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
I'm getting this error when I run this code.
Parse error: syntax error, unexpected 'users_kudos_to_posts' (T_STRING)
The code.
if ($number > 0) {
$arr=explode(",",`$upvoted);
//If I comment out everything below I still get the error. But if I comment out
//the above code, then the error goes away.
if (in_array($primary_id, $arr)) {
array_push($arr, $primary_id);
$new_string = implode(",", $arr);
//the line below is where the parse error is pointing too.
if ($stmt2 = $mysqli->prepare("UPDATE `users_kudos_to_posts` SET `upvoted` = ?
WHERE `user_id` = ?")) {
$stmt2->bind_param('si', $new_string, $session_user_id);
$stmt2->execute();
$stmt2->close();
}
}
}
What's crazy is that I have other multiple prepared statements in the same page of code with the same sql statement except for a change in columns and they work yet this doesn't.
Also, I ran the sql statement in phpmyAdmin and it works.
Problem is this line:
$arr=explode(",",`$upvoted);
You have an extra backtick that doesn't belong there. It should be:
$arr=explode(",",$upvoted);
As StackOverflow's syntax highlighting highlights (heh), you've got an extra backtick in your explode statement in front of `$upvoted:
$arr=explode(",",`$upvoted);
Related
I'm just asking a question on finding error details from the error function.
Like I would like to find error details from example.lua:50: "then" expected near "if".
Any ways on how to do that on Lua? I'm working on something for ComputerCraft on Lua. (Minecraft Java mod)
EDIT:
I'm trying make a function that returns the error parsed out. It's supposed to return 3 variables, var1: file name, var2: line number (if none it is specified nil), var3: error text.
example.lua is the file where the error is. 50 is the line number. There is a syntax error, likely in the if condition. (I'm not familiar with ComputerCraft, so I don't know where that file might be.)
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 2 years ago.
Improve this question
Windows 32, Delphi XE5. Database from Component ACE: Absolute database.
Form Create Procedure worked ok upto few hours ago. Suddenly resulted in error:
Cannot open File"Error Code 3" Error message: Can not find the path specified. Error 30364.
I have read many discussion with the same or similar problem but none gave me a good hint to solve.
The Procedure code is:
Procedure TForm1.FormCreate(Sender: TObject);
begin
ABSDatabase1.DatabaseFilename:= ExtractFilePath(Application.ExeName)+'LibCat.ABS';
ABSDatabase1.Open;
// showmessage(ABSDatabase1.Databasefilename);
ABSTable1.TableName:='Cat';
ABSTable1.Open; // gives error
ABSTable1.Last;
GetAppVersionStr;
Form1.Caption:=Form1.Caption +': Books Catalogue, ver. ' + Versione;
end;
The database file is in the same folder as the Project exe file. Any path of the option file point to the same folder.
I cannot imagine what modication I did to get this error.
On a step by step debugging the Database opens regularly, but the open Table gives the error.
On Object Inspector for Database the FileName is specified as .\LibCat.abs
Solved.
It was really a silly reason:
I examined carefully the .dfm file and I found that on "Object Inspector" providing data to ABSDatabase1 I have written the name and put at the end of the string a carriage return and a new line. Of course these characters where not visible on ID, only on .dfm file.
I do not know why this additional keys caused the error, but as I cleared them the Form was regularly generated and the program run perfectly.
Hope this can be useful to someone else.
I was wondering what this error meant while creating a case in a visit statement?
This is an example of the case causing it:
case (Statement) `<Lifetime lt>: <Statement stmt>` => (Statement) `<Statement stmt>`
My goal with this is just to delete the Lifetime statement together with the following colon.
Thank you for reporting this and many apologies for this brutal and incomprehensible message. The error means that there is a parse error in one of the concrete fragments between ` and `.
We will improve the reporting of this kind of errors!
This question already has answers here:
How to escape a JSON string to have it in a URL?
(6 answers)
Closed 6 years ago.
I need to pass the following URL:
https://api.softlayer.com/rest/v3/SoftLayer_Account/getVirtualGuests?objectFilter={"virtualGuests":{"hostname":{"operation":"hostnameTest"}}}
I tried by different ways, but it doesn't work, this is part of my code:
System.out.println(
given().
when().get("https://api.softlayer.com/rest/v3/SoftLayer_Account/getVirtualGuests?objectFilter={\"virtualGuests\":{\"hostname\":{\"operation\":\"hostnameTest\"}}}").asString());
}
Exception:
java.lang.IllegalArgumentException: Invalid number of path parameters. Expected 1, was 0. Undefined path parameters are: "virtualGuests":{"hostname":{"operation":"hostnameTest".
According to the exception, I think I should need to use path parameters, I tried with that but I didn't have success.
Also, I tried to replace { with character escape code %7B.
Any ideas? Thanks in advance
I just tried this:
encodeURI('{"virtualGuests":{"hostname":{"operation":"hostnameTest"}}}')
And it gives me:
"%7B%22virtualGuests%22:%7B%22hostname%22:%7B%22operation%22:%22hostnameTest%22%7D%7D%7D"
Thanks a lot Sebastian and Robert!
I didn't have success using the encodeURI, however I used queryParam and it works
given().
queryParam("objectFilter", "{\"virtualGuests\":{\"hostname\":{\"operation\":\"hostnameTest\"}}}").
when().get("/SoftLayer_Account/getVirtualGuests")
.then().assertThat().body("id", hasItem(1111111));
Many Thanks!
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
Scenario:
STEP 1:
STEP 2:
STEP 3:
Problem Summarized:
I started working with swift and its basic concepts.
First, I tried making an array ab with multiple different typed elements (not sure if it should be called an array). Then I tried to test an index value ab[2].
After testing an index value successfully, I made a dictionary dictAbc where I used different indices ab[4] ab[6] pointing to its keys. It introduced an error as mentioned in STEP 1.
I tried capping ab[2] into a print function as mentioned in STEP 2, it removed the error
Then I removed print method and made STEP 3 code same as STEP 1, it doesn't produce any error now.
Code:
import UIKit
var str = "Hello, playground"
var num: Float64 = 4.00000000000000000000000000
print("\(num)")
let a = "Hello"
let b = 12786
let c = a + String(b)
var ab = [1221, 123123, 123123,123123,"asdasd", "adasdasd", 1263781.123]
ab[2]
var dictAbc = ["hello":ab[4], "let":ab[6]]
dictAbc["let"]
Project Navigator Screenshot
Note: Xcode Version 7.0 (7A220)
Is something wrong with Playground compiler?
This is because of how a Playground works: it tries to evaluate every expression as soon as you've finished typing.
So when you type this quickly:
ab[1]
No errors, but if you take your time and pause with the cursor inside the brackets:
ab[]
you will indeed get the cannot subscript a value of type '[NSObject]' with an index of type '()' error, but this is only a temporary error message due to the "real-time" nature of the Playground.
If the error is still there after having typed the index number, then to make it disappear you just have to "wake up" the Playground by adding an empty line somewhere, adding a space after the expression, or adding other code, of course. The Playground will then re-evaluate everything and will remove the false error.