Forum Moderators: coopster
So this is a beard scratcher. I'm having trouble using the INSERT and DELETE commands. SELECT works fine, but if I go to insert/delete a record, the T-SQL statement will execute fine but the die portion will still display.
Here's my code...
$str_SqlConn = mssql_connect ( '[i]ip info[/i]', '[i]uName[/i]', '[i]uPassword[/i]' ) or die ( 'Can not connect to server' );
mssql_select_db ( '[i]db name[/i]', $str_SqlConn ) or die ( 'Can not select database' );
$str_SqlDelete = "DELETE FROM tbl_cat WHERE cat_id = " . $_GET["removeId"];
mssql_query($str_SqlDelete) or die("Query Failed: " . $str_SqlDelete);
After the code runs I check SQL Query Analyzer and it shows the record has been removed, however the "Query Failed..." portion still shows and the page fails to continue processing.
Anyone experience this before? Or does anybody know where I can get the exact ms sql error printed to the screen versus the "Query failed" followed by the delete statement?
Specs:
--> No access to php.ini
--> Microsoft box
--> Shared Hosting Plan
--> PHP Version 4.3.10
Thanks for your time!
M. Cold
1)is it possible for you to go directly to to db using putty and check to see if the records are updated as what the Query Analyzer thingy says?
2)furthermore, in mysql theres a mysql_error() function that returns any errors. in mssql i dunno of any except for mssql_get_last_message() which returns the last message by the server. try that and see what happens
Well I couldn't find anything on a equivalent mssql function for mysql_error.
However, I did discover a new clue! If I comment out the:
"or die("Query Failed: " . $str_SqlInsertStmt);"
Portion, everything works great. So, I guess I've at least scored a new light to shine on this issue. =)
Thanks,
M. Cold