Page 1 of 1

executing mssql query

Posted: Thu Jun 16, 2005 2:22 am
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?

Posted: Thu Jun 16, 2005 2:29 am
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.

Posted: Thu Jun 16, 2005 2:35 am
by harrison
then why do the $result returns false?

executing mssql query

Posted: Fri Jun 17, 2005 7:59 am
by Sharon_22
harrison wrote:then why do the $result returns false?
Can you check $query? It has an unnecessary brace in right side.