I found out that odbc_exec changes the value of $conn.
e.g
$conn = odbc_connect("name","user","pass");
now $conn = Resource id#1
odbc_exec($conn,$query)
now $conn = Resource id#3
this is obviously the problem but does anybody know if I to reconnect each time or is there a way around this.
thanks for any help.