Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP, MSSQL and Views! 1

Status
Not open for further replies.

Dogers

MIS
Jul 23, 2002
236
GB
Hiya

I'm using a DSN connection (therefore odbc) to connect to a SQL server from a Win2k3 machine. However I try, Ijust cant seem to get data from Views on the SQL server. I can run stored procedures fine, but views come back with the error:

[tt]Warning: SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]The request for procedure 'view' failed because 'view' is a view object., SQL state 37000 in SQLExecDirect in file.php on line 17[/tt]

I'm calling it with the line:
[tt]$queryres = odbc_do($res, "view");[/tt]


Can I use Views with PHP, or do I have to change everything to a stored procedure?
 
have you tried a select on the view? odbc_do requires a sql statement.

Why not use the native PHP mssql libraries?

Bastien

Cat, the other other white meat
 
Well, that code worked when the DSN was pointing at Access queries :)

Also, using the native mssql stuff needs a bit of rewriting - odbc should be able to handle what im doing with no problems!

And selecting from the view worked, thanks - I assumed views were like queries, you ran it and you had a recordset!? Time to get a book on SQL Server methinks :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top