A syntax error occurs when a program does not follow the syntactical rules of the programming language.
69
votes
16answers
86k views
mysql_fetch_array() expects parameter 1 to be resource, boolean given in select
I am trying to select data from a table but get this error message:
mysql_fetch_array() expects parameter 1 to be resource, boolean given..
This is my code:
$username = $_POST['username'];
...
58
votes
6answers
32k views
Why does Eclipse complain about @Override on interface methods?
I have an existing project that uses @Override on methods that override interface methods, rather than superclass methods. I cannot alter this in code, but I would like Eclpse to stop complaining ...
28
votes
5answers
661 views
Why is `continue` not allowed in a `finally` clause in Python?
The following code raises a syntax error:
>>> for i in range(10):
... print i
... try:
... pass
... finally:
... continue
... print i
...
File ...
26
votes
4answers
40k views
Chrome: Uncaught SyntaxError: Unexpected end of input
I have this project that i been working on its still in development. but i just uploaded it to a free host just as a test run before i get a paid host. Here is the link http://laurent.0sites.net/. ...
24
votes
4answers
3k views
How do I fix this missing semicolon syntax error in Javascript?
A friend wrote some code for me, and there was one file with a weird syntax error in it. After a bit of hunting, I narrowed it down to this section of code, which should reproduce the error:
var say ...
24
votes
3answers
23k views
json Uncaught SyntaxError: Unexpected token :
Trying to make a call and retrieve a very simple, one line, JSON file.
$(document).ready(function() {
jQuery.ajax({
type: 'GET',
url: 'http://wncrunners.com/admin/colors.json' ,
...
22
votes
3answers
7k views
SyntaxError: Unexpected token ILLEGAL
I'm getting this JavaScript error on my console:
Uncaught SyntaxError: Unexpected token ILLEGAL
This is my code:
var foo = 'bar';
It's super simple, as you can see. How could it be causing a ...
20
votes
2answers
25k views
SYNTAX_ERR: DOM Exception 12 - Hmmm
I have been working on a small slideshow / public display for a client that uses HTML5 Rock's Slideshow code. I have run into a DOM Exception 12 - a syntax error that is supposedly related to CSS ...
17
votes
5answers
542 views
Python Literal r'\' Not Accepted
r'\' in Python does not work as expected. Instead of returning a string with one character (a backslash) in it, it raises a SyntaxError. r"\" does the same.
This is rather cumbersome if you have a ...
15
votes
3answers
781 views
JavaScript: {}==false is a SyntaxError?
In Firefox 3.5, I type this in the Firebug console :
false=={} // => evals to false
{}==false // syntax error
What is the explanation for this ?
14
votes
7answers
61k views
What to do with “Unexpected indent” in python?
How do I rectify the error "unexpected indent" in python?
13
votes
2answers
236 views
Build dynamic array in PHP
I need to create an array using a object using different format/structure
I have:
$t = object()
$t > user = object()
$t > user > 0 (object) name = 'wilson';
$t > user > 0 (object) ...
12
votes
2answers
6k views
In Ruby, how do I check if method “foo=()” is defined?
In Ruby, I can define a method foo=(bar):
irb(main):001:0> def foo=(bar)
irb(main):002:1> p "foo=#{bar}"
irb(main):003:1> end
=> nil
Now I'd like to check if it has been defined,
...
11
votes
2answers
12k views
Python print statement “SyntaxError: invalid syntax”
Why is Python giving me a syntax error at a simple print statement at line 9?
version is:
Python 3.2.2 (default, Sep 4 2011, 09:07:29) [MSC v.1500 64 bit (AMD64)] on win
32
code is:
import ...
11
votes
2answers
409 views
Creating a list with >255 elements
Ok, so I'm writing some python code (I don't write python much, I'm more used to java and C).
Anyway, so I have collection of integer literals I need to store.
(Ideally >10,000 of them, currently ...