0

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

3
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by pebesoft
0

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

0

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)
0

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

0

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());
}

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.