syntax-error

PHP Error: mysql_fetch_array() expects parameter 1 to be resource, boolean given

Hi I am trying to select data from table but get this error message: mysql_fetch_array() expects parameter 1 to be resource, boolean given.. This is my code: $username = $_POST['username']; $password = $_POST['password']; $result = mysql_query('SELECT * FROM Users WHERE UserName LIKE $username'); while($row = mysql_fetch_array($re...

Why does this simple bash code give a syntax error?

I have the following bash code, which is copied and pasted from "bash cookbook" (1st edition): #!/bin/bash VERBOSE=0; if [[ $1 =-v ]] then VERBOSE=1; shift; fi When I run this (bash 4.0.33), I get the following syntax error: ./test.sh: line 4: conditional binary operator expected ./test.sh: line 4: syntax error near `=-v' ./...

Haml::SyntaxError in Static#home?

I have this Haml: #index-header %h1 Supersonic Mac Software. %p Some motto %h1 Our Software %p Which will once becoume your's .third-column %h2 Product 1 %p LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL .third-column %h2...

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING

I am getting the following error when i upload the file to my host server. Same thing works fine in my machine running xampp Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home1/mobyhold/public_html/admin-arabiadc/admin/_product.php on line 1 <? include "../include/manager_shared.php"; if(isset($_REQUEST['subm...

Export PYTHONPATH - syntax error.

I need to connect MySQLdb - module. I download MySQLdb - module and install it. But when i write (in python interactive shell): import MySQLdb - i get no module named MySQLdb. Then i decided to include MySQLdb directory in PYTHONPATH variable. I write (in python interactive shell): export PYTHONPATH=${PYTHONPATH}:/where/module/live...

Whats wrong with this Data Explorer SQL query?

I am trying to write a How much did I type? query on Stack* Data Explorer. Modifying an existing query got me this far: -- How much did I type? DECLARE @UserId int = ##UserId## select sum(len(Body)) AS 'Posts' from posts where owneruserid = @UserId, select sum(len(Text)) AS 'Comments' from comments where userid = @UserId, (sele...

SQL Syntax error CREATE PROCEDURE AS EXTERNAL

Question: If I add IF not exists to a create procedure as external name statement, I get a syntax error... why? Both statements work fine if I run them separately... IF NOT EXISTS ( SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'PriceSum') AND type in (N'P', N'PC') ) CREATE PROCEDURE PriceSum(@sum int OUTPUT) ...

DB2 error on TSQL using SELECT AS alias and an inner join

I am writing a T-SQL program over a DB2 database on a LINUX box (DB2/LINUXX8664) using a linked server. I think the DB2 is Version 9.5.3 but not certain. I am receiving an error that I feel is likely a DB2 issue as the syntax checks out okay in T-SQL. This is the code: IF(SELECT(OBJECT_ID('TEMPDB..#TempFile))) IS NOT NULL DROP TABLE #Te...

What's wrong with this OCaml code?

What's wrong with this code? let vm_run vm = let guard = ref true in while !guard do if vm.cur_pc = -1 && not (Stack.empty vm.call_stack) then vm_pop_ar vm else if vm.cur_pc = -1 then guard := false else if vm.cur_pc < Array.length vm.cur_code then execute vm Array.get vm.cur_code vm.cur_pc; ...

Strange Python behavior from inappropriate usage of 'is not' comparison?

I (incorrectly?) used 'is not' in a comparison and found this curious behavior: >>> a = 256 >>> b = int('256') >>> c = 300 >>> d = int('300') >>> >>> a is not b False >>> c is not d True Obviously I should have used: >>> a != b False >>> c != d False But it worked for a long time due to small-valued test-cases until I happened to u...

SQL DB2 sql error INCORRECT SYNTAX

What am I missing in this code below that will cause the error: Msg 170, level 15, line 113 line 113: Incorrect syntax near 'actual_completion_date'. update #Loss_mit_step set [STEP924_COMPL_DATE] = Case when step_code ='924' then ls_actual_completion_date else ' ' end, [STEP926_COMPL_DATE] = Case when step_code ='926' then ...

How can I define a string in a python function?

Hi, I'm playing with Python and Google App Engine for the first time but am unable to define a string within my function (mytest2), I get an indentation error on the line after the declaration. I can define one in the parameters that works (test) but can't see why I wouldn't be able to do it in the function aswell. I've read a few tuto...

' " ' and " ' " in Java .. How to deal with them ?

I'm writing this in JAVA : stmt.executeQuery("SELECT * FROM mytable INTO OUTFILE '/tmp/mytable.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '\\' LINES TERMINATED BY '\n' ;"); This is has to be written between " " as show because It has to be a String. However, when I run the code it says "Unclosed String and Cha...

Why is Python saying pow only has 2 arguments

Why is python telling me "TypeError: pow expected 2 arguments, got 3" despite it working in IDLE (sometimes it tells me that in IDLE as well)? im simply doing pow(a,b,c). my program is very short and i do not change the definition of pow at any time since i need to use it for some exponentiation. NOTE: This is the pow from __builtin__, ...

mysql create procedure syntax issue line 1

Hello All. I get a syntax error on line 1 of the following procedure: DELIMITER | CREATE PROCEDURE sp_autocallFillCallQueue BEGIN DECLARE maxCalls TINYINT(1); SELECT autocall_maxCalls INTO maxCalls FROM `options` LIMIT 0,1; REPEAT INSERT INTO `callQueue` (`phoneNumber`, 'waiting') SELECT `phoneNumber` FR...

struct declaration syntax error

I have the following code: #include <iostream> using namespace std; struct stud{ int roll; char name[10]; double marks; } struct stud stud1={1,"ABC",99.9}; struct stud stud2={2,"xyz",80.0}; int main(){ cout<<stud1.marks<<"\n"<<endl; cout<<stud1.name<<"\n"; cout<<stud1.roll<<"\n"; return 0; } But t...

Python if statement "SyntaxError: invalid syntax"

Hi, Trying to execute someone's code, getting a syntax error. No idea why :( def GetParsers( self, systags ): childparsers = reduce( lambda a,b : a+b, [[]] + [ plugin.GetParsers( systags ) for plugin in self.plugins ] ) parsers = [ p for plist in [ self.parsers[t] for t in systags if self.parsers.has_key(t) ] for p in plist ] ...

Variable '<variablename>' hides a variable in an enclosing block

When copying and pasting a bit of sample code from MSDN, I came up with the error in the title - Variable '' hides a variable in an enclosing block, All I copied was a very basic example of a try loop. As it says in the suggestion "A common cause for this error is the use of Catch e As Exception inside an event handler. If this is the ...

Parse error in php.

in my website all pages contain Follow Us panal so inspite or writing it on all pages I have created a seperate modFollow.php file and included it in all pages, I don't know whether its a correct way or not but I am gettein this error message- my indexpage code - <div class="follow"> <?php include 'modFollow.php'; ?> ...

Using certain functions from stdlib.h or stdio.h causes syntax errors

I'm working on some C code in Visual Studio 2005 on Win7 Pro x64. The code is correct; it compiles and runs on MinGW under Eclipse. However, using certain functions from the standard C libraries like stdio or stdlib causes the following lines to exhibit syntax errors when the code is built in VS2005. As an example: #include<time.h> #...