Re: Warning: odbc_exec() [function.odbc-exec]: SQL error: [unixODBC][FreeTDS][SQL Server]Invalid cursor state, SQL state 24000 in SQLExecDirect in
"James K. Lowden" <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
Ran September wrote: > $conn=odbc_connect($db_host,$db_user,$db_pass); > $sql="SELECT * FROM gages where company = '$custid' and gage_sn = > '$sn'"; $rs=odbc_exec($conn,$sql); ... > $sql1="SELECT * FROM mpc_web_users where user_name = '$userid'"; > $rs1=odbc_exec($conn,$sql1); ... > on line 64 odbc_exec() didn't work and that's when the error occurred. > i have many scripts like that, some worked and some aren't i really > need a one time solution rather than re-programming my scripts. http://www.freetds.org/faq.html#pending This is what the FAQ means by "For one thing, they become better programmers". If your first query had an outer join to mpc_web_users, the second query would be unnecessary. Your script would be simpler and run faster because it would make only one call to the server. Alternatively (but worse) the second query could use a separate connection. Both solutions work with all SQL database systems. The script as written does not. --jkl