Welcome aboard yoma, two things:
This is not a problem with PHP, it's a problem with mySQL. Try taking the select statment and pasting it right into PHPmyAdmin or whatever database interface you use.
Second, I don't **think** this is the exact location of your error, because
syntax to use near '|371|'
There's no possibility of such a value in your select (that I can tell.) If you had a
where with that select, it would be different, but you don't.
trying to do a product export
Are there any subsequent insert statements
after this? I'm speculating (and that's all it is, really) that you're pulling the records and inserting them somewhere, which would be the only place you could arrive at |371|. I see your die error agrees with the select, but a mistake I've made before . . . .
$query = "select * from table";
$result = mysql_query($query) or die("Error $query");
// blah blah
$query2 = "insert into table(fields) values('values')";
$result = mysql_query($query2) or die("Error
$query");
Which would mislead you to think the problem is in query 1. By your query error,it can't be (again, I don't *think* it can) . . . been there, done that.
Try the select in phpMyAdmin, if it runs, it's something else.