syntax-error

Parse error: syntax error, unexpected T_DOUBLE_ARROW PHP

I'm getting a Parse error: syntax error, unexpected T_DOUBLE_ARROW PHP on line 47, which is 'post_content' => $thisShow['content'], Anyone got any ideas why? protected function _saveShow($thisShow) { $saveData = array( 'mid' => $this->_saveAsUserId, 'post_title' => $thisShow['title'], ...

Unexpected T_ELSE error in PHP

I am working on an example from a php book and am getting an error on line 8 with this code <?php $agent = getenv("HTTP_USER_AGENT"); if (preg_match("/MSIE/i", "$agent")); { $result = "You are using Microsoft Internet Explorer"; } else if (preg_match("/Mozilla/i", "$agent")); { $result = "You are using Mozilla firefox"; } else...

PHP syntax error “unexpected $end”

I have 3 files 1) show_createtable.html 2) do_showfielddef.php 3) do_showtble.php 1) First file is for creating a new table for a data base, it is a fom with 2 inputs, Table Name and Number of Fields. THIS WORKS FINE! <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8...

Syntax error when using "with open" in Python (python newbie)

[root@234571-app2 git]# ./test.py File "./test.py", line 4 with open("/home/git/post-receive-email.log",'a') as log_file: ^ SyntaxError: invalid syntax The code looks like this: [root@234571-app2 git]# more test.py #!/usr/bin/python from __future__ import with_statement with open("/home/git/post-receive-email.log"...

parse error occured in my php script

i used javascript and php script as mixed. i got a parse error this is the code <script language="JavaScript1.1"> var photos=new Array() var which=0 <? for($i=0;$i< count($productdata2);$i++) { foreach($productdata2 as $row) {?> // the error occured at this line photos[0]=<?=base_url().'uploads/'.$productdata2[$i]->image;?...

Strange Syntax Parsing Error in Python?

Am I missing something here? Why shouldn't the code under the "Broken" section work? I'm using Python 2.6. #!/usr/bin/env python def func(a,b,c): print a,b,c #Working: Example #1: p={'c':3} func(1, b=2, c=3, ) #Working: Example #2: func(1, b=2, **p) #Broken: Example #3: func(1, b=2, **p, ...

What is wrong with this PHP function.

I am new to PHP and regular expression. I was going thorugh some online examples and came with this example: <?php echo preg_replace_callback('~-([a-z])~', function ($match) { return strtoupper($match[1]); }, 'hello-world'); // outputs helloWorld ?> in php.net but to my surprise it does not work and keep getting error: PHP Parse ...

php, for each, syntax error

. Hi, this is my code, don't know why but I have a stupid syntax error,on the marked line. Please bring some light for a php nob. Parse error: syntax error, unexpected ')', expecting ';' in /var/www/stats/upd_tr_stats.php on line 38 ...

Parse error: expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in ..?

I tried to put an if statement inside an echo but this parse error came up, is it not possible to do that? should I use heredoc instead? echo "<input name='main_branch' type='radio' value='1' <?php if($restaurant['main_branch'] == 1) { echo "checked"; } ?> />Yes <input name='main_branch' type='radio' value='0' <?php if($restaurant['main...

Python invalid syntax with "with" statement

Hello all, I am working on writing a simple python application for linux (maemo). However I am getting SyntaxError: invalid syntax on line 23: with open(file,'w') as fileh: The code can be seen here: http://pastebin.com/MPxfrsAp I can not figure out what is wrong with my code, I am new to python and the "with" statement. So, what is c...

Declaring more than one SPIM array causes a syntax error

Below is the beginning of a chunk of SPIM code: .data a: .space 20 b: .space 20 .text set_all: sw $ra,0($sp) li $t0,0 li $t1,10 ............ Unfortunately, the second array I declare ('b') causes the SPIM interpreter to spit out: spim: (parser) syntax error on line 3 of file spim.out b: .space 20 ...

Why is Python 3.1 throwing a SyntaxError when printing after loop?

Hi, I'm trying to run this snippet in Python 3.1 console and I'm getting SyntaxError: >>> while True: ... a=5 ... if a<6: ... break ... print("hello") File "<stdin>", line 5 print("hello") ^ SyntaxError: invalid syntax >>> (This is just shortened code to make a point.) Am I missing something? Is ther...

Getting the error "Unexpected $end" in my class file

I'm writing a php library that handles different products, somewhere in my class I must have a missing curly brace or something but I can't find it. Does someone with a debugger or keen eyes see anything wrong with this code? http://pastie.org/953994 Thanks in advance! Edit: I think it's something with the query in the EquipmentData...

Parse error after upgrading to PHP 5.3

I have a php code that works well in PHP 5.2 but throwing "Parse error: syntax error, unexpected '}'" after upgrading to PHP 5.3. When I use echo/print or heredocs to print all the HTML part of the code, the error is gone. My question is, why this error occurred? Is this mean that in PHP 5.3 we are no longer allowed to put HTML code in...

Code doesn't work in foreach

Here is my code: var divarray = document.getElementById("yui-main").getElementsByTagName("div"); var articleHTML; var absHTML; var keyHTML; var bodyHTML = []; for( var i in divarray) { if(divarray[i].className == "articleBody"){ articleHTML = divarray[i]; for( var j in articleHTML ){ bodyHTML[i] = ''; ...

php class crash course

I'm going crazy trying to write my first php class; it is supposed to connect me to server and to a database but I'm always getting this error: Parse error: syntax error, unexpected ',', expecting T_PAAMAYIM_NEKUDOTAYIM in /Applications/XAMPP/xamppfiles/htdocs/classTest/test.php on line 9 Thanks in advance, here is the code: <?php // ...

php error with post inside variable

Trying to do this: $product_description = 'Credit balance of &#8364;' $_POST['creditamount'] ; Want to display that post inside my variable but get this Parse error: syntax error, unexpected T_VARIABLE in /var/www/account/credits/moneybookers/process.php on line 48 What am i doing wrong?? ...

Visual C++: Compiler Error C4430

The code of Game.h: #ifndef GAME_H #define GAME_H class Game { public: const static string QUIT_GAME; // line 8 virtual void playGame() = 0; }; #endif The error: game.h(8): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int game.h(8): error C2146: syntax error : missing ';'...

Ternary Operators in JavaScript Without an "Else"

I've been using them forever, and I love them. To me they see cleaner and i can scan faster, but ever since I've been using them i've always had to put null in the else conditions that don't have anything. Is there anyway around it? E.g. condition ? x=true : null ; basically, is there a way to do: condition ? x=true; Now it shows up as...

Why Java does not allow overriding equals(Object) in an Enum?

@Override public boolean equals(Object otherObject) is not allowed in Java for an Enum, since the method equals(Object x) is defined as final in Enum. Why is this so? I cannot think of any use case which would require overriding equals(Object) for Enum. I'm just curious to know the reasoning behind this behavior. ...