Hello all,

Think I am going mad
I want to do a simple update and get a parse order at line 1.

1: UPDATE ir312 // the table name
2: SET
3: R3_21 = $tot // R3_21 is the field name, $ tot is an amount
4: WHERE irdnumber=$irdnumber

The table name is correct
$ irdnumber has been checked
Alhough that does not matter because it stops at UPDATE at line 1

I can see no error what is wrong?

Please help

Peter

before executing query you echo it for example. copy that query result from browser and run in phpmyadmin, is it running there

$query="update ir312 SET R3_21 = $tot WHERE irdnumber=$irdnumber ";
echo $query;
mysql_query($query)

several reason for query failure.
1) On linux mysql table name are case sensitive
2) have you selected proper database before executing query

also remember the single inverted commas for the variables in the query:

$query="update ir312 SET R3_21 = '$tot' WHERE irdnumber='$irdnumber'";
    echo $query;
    mysql_query($query)

thanks for you suggesion, but I still get the parse error question on the first line.
PB

post your code here

I found a way:

This is the code that works

mysql_query("UPDATE ir312 SET R3_21 = $tot WHERE irdnumber='$irdnumber'") or die(mysql_error());
}

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.