executing mssql query

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
harrison
Forum Commoner
Posts: 30
Joined: Thu Jun 09, 2005 12:23 am

executing mssql query

Post by harrison »

Everytime i execute a query using mssql_query, I get an error saying "Changed database context at XXX". here's the code:

Code: Select all

mssql_connect($server_name,'sa','');
mssql_select_db($db_name);
$query = "SELECT * FROM $table_name WHERE refno=$sel_refno");
$result = mssql_query($query);
if($result){
   // do stuff ...
}else{
   die(mssql_get_last_message());
}
mssql_close();
Can anyone tell me what's wrong with my code or the server itself?
Syranide
Forum Contributor
Posts: 281
Joined: Fri May 20, 2005 3:16 pm
Location: Sweden

Post by Syranide »

http://dbforums.com/t964707.html

"These messages are considered to be normal behavior of the driver, and are
purely informational."

Dunno why you your query wouldn't work though, as it _should_ work even though you get that warning according to that.

PS. I was faster than your PM :P
EDIT: seems like adodb, but the same should apply I guess.
User avatar
harrison
Forum Commoner
Posts: 30
Joined: Thu Jun 09, 2005 12:23 am

Post by harrison »

then why do the $result returns false?
Sharon_22
Forum Newbie
Posts: 2
Joined: Fri Jun 17, 2005 7:39 am

executing mssql query

Post by Sharon_22 »

harrison wrote:then why do the $result returns false?
Can you check $query? It has an unnecessary brace in right side.
Post Reply