Your suggestion sounds interesting. But how to close
the link? Do you mean mssql_close()? What I know is
that we can do multiple querys during one database
connection. 

I guess I didn't explain my problem clear enough.
Sorry about that. 

My point is why query works always well until the
first update query("insert","update","delete"). It
doesn't matter how many select query before that.
It could be 10 "select" or none. But once update query
appears, I get "query failed". The interesting thing
is, this query is acturally executed in my database
but return false. Then all the other querys follow
this one are failed and no affect to my database.
This table might help:
                        return    affect db
-----------------------------------------------       

connect...               true 

repeat 0 or n:
  query("select...")     true        
done

query("insert...")
or query("update...")     
or query("delete...")    false       Yes

repeat 1 or n:
 query("select...")
 or query("update...")
 or query("delete...")
 or query("insert...")   false        No 
done  

close...                 true

Did anyone try this on your machine? What did you get?

jongjong

--- Kelvin <[EMAIL PROTECTED]> wrote:
> Hi Jong,
> 
>     The problem is your Query is in looping
> situation. Because you didn't
> close the link after your first inserted.
>      It doesn't matter that you use (mssql_free),
> you still need to close
> the link first.
>     The function of mssql_free is just free up the
> content of that variable,
> but it won't close the link for U.
> 
> Kelvin.
> 
> "jong jong" <[EMAIL PROTECTED]> wrote in message
>
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I got the error messages with your help.
> Unfortunatly,
> > I didn't see any problem in these message. Here is
> the
> > messages on my browser by loading the php file:
> >   Changed database context to 'pubs'.
> >   Changed database context to 'pubs'.query2
> failed!
> >   Changed database context to 'pubs'.query3
> failed!
> >
> > It didn't tell me anything about why query failed.
> My
> > code is like this:
> > <?
> >   $conn=mssql_connect("xxx","xxx","xxxxxxxx");
> >   mssql_select_db("pubs",$conn);
> >
> >   $result=mssql_query("select * from authors");
> >   echo mssql_get_last_message();
> >   if (!$result)
> >     echo "query1 failed!";
> >   mssql_free_result($result);
> >
> >   $result=mssql_query("insert into pub_info values
> >                        (0001,null,'test1')");
> >
> >   echo "<p>".mssql_get_last_message();
> >   if (!$result)
> >     echo "query2 failed!";
> >   else
> >     mssql_free_result($result);
> >
> >   $result=mssql_query("insert into pub_info values
> >                        (0002,null,'test2')");
> >   echo "<p>".mssql_get_last_message();
> >   if (!$result)
> >     echo "query3 failed!";
> >   else
> >     mssql_free_result($result);
> > ?>
> >
> > When I look into the table on MSSQL Server, Record
> > "0001,null,test1" was inserted.
> > But no record "0002,null,test2". This makes me
> feel
> > that query2 and query3 failed on different
> reasons!
> > Any one see why query2 failed and query3 failed?
> >
> > Thanks,
> > jongjong
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Get personalized email addresses from Yahoo! Mail
> > http://personal.mail.yahoo.com/
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> To contact the list administrators, e-mail:
> [EMAIL PROTECTED]
> 


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to