Re: Warning: odbc_exec() [function.odbc-exec]: SQL error: [unixODBC][FreeTDS][SQL Server]Invalid cursor state, SQL state 24000 in SQLExecDirect in
Ran September <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
ok thx jkl, i appreciate your help... i will try to become a "better programmer" :-D although i didn't get the "outer join to mpc_web_users" part (sorry for being silly.) but is it true that installing the mssql.so will solve this? Thanks. On Wed, Feb 18, 2009 at 7:19 PM, James K. Lowden <[email protected]>wrote: > 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 > _______________________________________________ > FreeTDS mailing list > [email protected] > http://lists.ibiblio.org/mailman/listinfo/freetds > -- R