can create tables, can't select, insert or update

julian at zol.co.zw julian at zol.co.zw
Sat Apr 6 00:11:59 EST 2002


I have finally got php-4.1.2 to talk to mssql2k on win2k through apache 1.3.22 using freetds-0.53 -- thanks for that. 

I can make a table, but I can't select, insert or update. I get 
"SELECT permission denied on object 'test', database 'Julian', owner 'julian'" etc.
I do have these permissions on the server.

Here's the php:

mssql_connect($hostname,$username,$password);
mssql_select_db($dbName);

// this does work:
$create_query = "create table test (
          UserID int NULL ,
          username  varchar (20) NULL ,
          password varchar (20) NULL ,
          )";

// this does not work:
$insert_query = "Insert into test (UserID, username, password)
VALUES (123, 'ADMIN', 'thispassword')";

// this does not work:
$select_query = "select UserID from test";

$result = MSSQL_QUERY($select_query);

$number = MSSQL_NUM_ROWS($result);

$i=0;

if ($number == 0) :
        print "No data?";
elseif ($number > 0) :
        print "Data:";
        while ($i < $number) :
                $username = mssql_result($result,$i,"username");
                print $username;
                print "";
                $i++;
        endwhile;
endif;

-- any ideas where Ive gone wrong? 

TDSDUMP and tcpdump on port 1433 record nothing when I do one of the failed queries, but I do get records of any CREATE TABLE query.






More information about the FreeTDS mailing list