MSSQL, SOAP, PHP

Do you have questions regarding other database enginges (not MySQL) -- ask here!

Moderators: egami, macek, gesf

Post Reply
User avatar
ruturajv
php-forum Super User
php-forum Super User
Posts: 1279
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India
Contact:

Tue Jul 26, 2005 10:55 am

you can use

Code: Select all

<?php

if ($res = mssql_query($sql)) {
  // successfull query
} else {
  // false
}

?>

User avatar
gesf
Moderator
Moderator
Posts: 1716
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Tue Jul 26, 2005 3:07 pm

Also if your first IF statement doesn't work, consenquently, your mssql_select_db() wont work too because of the link identifier ($db_link).
So like ruturajv example... try working around those IF statements... I bet it would be something related to it.
Sincerely,
Gonçalo "gesf" Fontoura

gesf.org | sessionstart.com | urlms.com

User avatar
gesf
Moderator
Moderator
Posts: 1716
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Wed Jul 27, 2005 12:56 am

Yep i understood and thats a weird problem... thats why sometimes we got to play with code to better fit our needs.
Try something like:

Code: Select all

<?
class SQL {
  // .....
  function SELECT($sql, $db) {
     $db_link = (mssql_connect('MUHA','root','pseto')) ? 1 : 0;
     if(!$db_link){
        // ...same problem
     }else {
        $db_s = (mssql_select_db($db, $db_link)) ? 1 : 0;
        $return[0] = 'OK';
        return new SOAP_Value('return','{urn:SQL}ArrayOfStrings', $return);
     }
       
     if(!$db_s) {
        $return[0] = 'failed';
        return new SOAP_Value('return','{urn:SQL}ArrayOfStrings', $return);
     }

  }
  // .....
}
// ....
?>
I really can't see a reason for this problem. Actually the only thing which seems to be causing this are the IF's statements.

--
Out from job now, so got to sleep, but... will take a better look at this problem ASAP.
Sincerely,
Gonçalo "gesf" Fontoura

gesf.org | sessionstart.com | urlms.com

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2213
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Wed Jul 27, 2005 3:00 am

doesnt have to be a BUG.. it could simply be the way mssql package works and you should seriously read through whe documentation for that package and see the differences..
Best Regards,
Alexej Kubarev
-------------------------------
Zend Certified Engineer
Image Image

User avatar
ruturajv
php-forum Super User
php-forum Super User
Posts: 1279
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India
Contact:

Thu Aug 04, 2005 9:20 pm

you need to specify the port 1433
soe

Code: Select all

<?php
mssql_connect(192.168.0.23:1433, 'usrename', 'password'); // for linux
mssql_connect(192.168.0.23,1433, 'usrename', 'password'); // for windows
?>

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest