Tag: microsoft
Windows Live Messenger Error 80048821
by z3n on Apr.24, 2010, under Tips & Hints, windows
Problem:
After upgrading to the new windows live messenger you find out that you can’t connect to it anymore, no matter what and how you try it simply gives you Error: 80048821. Seeking for help at microsoft using crypt error message only gives you a bunch of useless answers.
Solution:
Despite from the solutions posted on the source link, that didn’t worked for me, i saw a comment on the very same page that said to try the login all in CAPS. That was what fixed the issue.
Source:
variable Object MSSQL note
by z3n on Sep.25, 2009, under Notes
Problem:
return $res->Fields['field_name']->Value;
returns `variable Object`
Solution:
return intval($res->Fields['field_name']->Value);
Explanation:
There’s no explanation, this is one of those issues that happens when you deal with microsoft. Sometimes when doing a query it returns the actual value, other times it just return into a different variable type, which needs to be converted. Good thing if you caught it before writing a more complex code and then finally dealing with crypt errors :)
Bonus:
I’ve been getting some more issues even when using this conversion, things like “Object of class variant could not be converted to string php“, this happens on null values, in order to fix i been searching around and found this, which with some changes it will be better like:
-
for ($col=array(),$i=0,$j=$ms_res->Fields->Count();$i < $j;$i++) {
-
try {
-
$value=$ms_res->Fields[$i]->Value;
-
if (trim($value) != "") {
-
if (gettype($value) !== 'string') {
-
if (settype($value,"string")) {
-
$col[$ms_res->Fields[$i]->Name]=$value;
-
}
-
} else {
-
$col[$ms_res->Fields[$i]->Name]=$value;
-
}
-
} else {
-
$col[$ms_res->Fields[$i]->Name]='NULL';
-
}
-
} catch (exception $e) {
-
_r("Exception: ".$e);
-
}
-
}
..and yes you will figure out the missing functions/vars.
MSSQL+PHP = Issues
by z3n on Jul.21, 2009, under Coding
Problem:
On a simple MSSQL (Microsoft SQL Server) with PHP you get this error:
Warning: mssql_query() [function.mssql-query]: message: Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier. (severity 16)
and the best, it dosen’t matter if you convert the data to a different type.P>
Solution:
It looks like that mssql library at php can’t handle the ntext objects right, or at least the way you’re calling it is not right, the ONG>wrong way is:
function _connect_mssql() {
global $_msql,$_msql_id;
if (!$_msql_id) {
if ($_msql=mssql_connect(dbserver,dbuser,dbpass)) {
mssql_select_db(db,$_msql) or die("Unable to select database: ".db);
$_msql_id=1;
} else {
die("Couldn’t connect to database");R> }
$_msql_id=1;
}
}
function _qm($sql) {
global $res,$_msql,$_msql_id;
if (!$_msql_id) { _connect_mssql(); }
$res=mssql_query($sql,$_msql);
if (!$res) { die("Error on query: ".$sql); }
}
Those are simple functions to call it without using a class or too much paraphernalia. And it doesn’t work when the table has a ntext column on it, now a function that works with any type of table:P>
function _connect_mssql() {
global $_msql,$_msql_id;
if (!$_msql_id) {
$_msql=new COM("ADODB.Connection");
$_msql->Open("Provider=SQLOLEDB.1;Password=".dbpass.";Persist Security Info=True;User ID=".dbuser.";Initial Catalog=".db.";Data Source=".dbserver);
$_msql_id=1;
}
}
function _qm($sql) {
global $res,$_msql,$_msql_id;
if (!$_msql_id) { _connect_mssql(); }
$res=$_msql->Execute($sql);
if (!$res) { die("Error on query: ".$sql); }
}
$_msql="";$_msql_id=0;
Note that I used a class and ADODB connection instead, this works prefectly.