Using the mssql extension based on Microsofts library (ntwdblib.dll) will
have limitations like column length 30 bytes and character columns has a
max length of 255 bytes.
If you use the same extension based on the FreeTDS version of the dblib
library these limitations goes away. Even on Windows
Keep calling odbc_resilt() untill everything is returned:
$str = ;
while ($tmp = odbc_result($rs, $column)) {
$str .= $tmp;
}
You can also use odbc_longreadlen() to set the number of bytes returned by
each call to odbc_result().
- Frank
Hi,
I've got a PHP 5 based website, talking to a
Sounds like a permission problem. Make sure the IIS user (IUSR_maschine
name) has access to the share.
- Frank
Hello,
Im using PHP to connect to a Microsoft Access database which is not
stored
on the machine where IIS is installed. It's located on a different file
server on the network.
Or use the mssql.secure_connection = On in php.ini to allow the system to
use the current user account for authentication.
- Frank
Hello,
If you can change the SQL Server Authentication to the Mixed Mode
(Windows and Remote User), your problem will be fixed. If you use the
Unix
like
Hi Claudio,
1) Check the version of FreeTDS on both systems.
2) Check the freetds.conf file for differences (use the sam TDS version)
3) Check that php is compiled using --with-mssql on both systems
(--with-sybase will give you aliases to some mssql_( functions but not
all)
- Frank
Hi all!
so I think you will be happy about
the change.
- Frank
Hi Frank,
El vie, 12-01-2007 a las 10:49 -0800, Frank M. Kromann escribió:
1) Check the version of FreeTDS on both systems.
It proved irrelevant. See above.
2) Check the freetds.conf file for differences (use the sam TDS
IIRC: When you are using ISAPI you must have php,ini in the windows
directory.
If you are using CGI you can have it in the same directory as all other
PHP files.
- Frank
Hi
Make sure that the php.ini file being used is the one you thinkit is.
I keep mine in the php directory, so I have
Try the MSDN library:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdobjconnectionpme.asp
- Frank
Chris wrote:
Todd Cary wrote:
[Sorry - I misposted this in the General group]
I am in the process of converting my clients PHP scripts that are
using
What about 'select count(*) from aTable'
- Frank
Is there a way to get the number of rows that would have been returned
had
there not been a LIMIT clause in a SELECT statement?
For example, if
Query #1) SELECT * FROM aTable
would normally return 100 rows. But
Query #2) SELECT * FROM
The MSSQL extension does not rely on MySQL in any way. The only required
DLL is ntwdblib.dll.
It would help if you could post any error messages or some sample code
that shows your problem.
The 'correct' installation is to copy ntwdblib.dll to windows\system32 on
the system that runs the PHP
Hi Jim,
Using PHPRC is not needed on Win32. It's an option.
If you read my post again you will see that I did not say anything about
putting PHP dll's in system32. I was refering to ntwdblib.dll. This is not
a PHP dll, it's a Microsoft DLL that will be installed with the CLient
Tools.
I agree
All versions of ntwdblib.lib has this problem. The problem was introduced
when it was decided to fix another problem haver a char column with value
'aaa ' would be reduced to 'aaa' by the php extension.
I have not tested this issue with the FreeTDS version of this extension
(so far only
Hi Todd,
PHP has native support for MSSQL Server. On a *nix platform you need to
install and configure FreeTDS and recompile php using --with-mssql, but
then you will be able to use the mssql_* functions.
- Frank
I have been asked by my client to use SQL Server for my php application
Hi Denio,
The function name should say it all, mssql_get_last_message() returns the
last and only the last message from the server. I'll add an item on my
todo list to implement a mssql_get_server_messages() function tal will
allow you to get all messages from the previous mssql_query() call.
You can have PHP generate a small javascript section where you define the
variables or you can use cookies.
- Frank
Hi there everyone,
Just a quick question, I have a login system that stores whether you
are
logged in or not with a PHP Session. However, I need it so when people
Hi Jim,
echo cannot display the content of an array or object. try print_r() or
var_dump()
- Frank
Ok,
I'm a PHP newbie and I'm having a problem. All I want to do is parse
some information out of a database and send someone and email stating
that their posting has been approved.
If you are looking for precompiled win32 binaries you can find them here:
http://kromann.info/php.php or included in the zip files on
http://snaps.php.net
- Frank
Does Anyone know where can i get the latest and already fixed mssql
extensions??
thank you
--
PHP Database Mailing List
Sessions work fine with IIS.
Check you php.ini file for register_globase if that is off (default) you
can only access your variables through $_SESSION[]
- Frank
can you show some code?
bastien
From: Adil [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] IIS/PHP question
Date:
Hi Adil,
You need to configure session.save_path in php.ini. This setting needs to
point to a directory where the IIS user can write files.
If you are running the ISAPI version of php you also need to restart the
web service for the changes to take place.
- Frank
Hey everyone,
I'm trying
mssql_init() is a function used to initialize stored procedures and it was
introduced inphp 4.1.0 (according to the docs). The versions you are
listing for both PHP and FreeTDS are very old so I would suggest updating
these first.
- Frank
Damien Babilon [EMAIL PROTECTED] wrote in message
That depends on the SAPI you are using. With CGI or FastCGI there is no
problem but with ISAPI or Apache module you might get problems, as the
DBLIB library used to build the extension is not thread safe.
- Frank
I am currently writing code to write and read data to a Microsoft SQL
2000
Hi David,
You problem might be a thread safty issue. the MSSQL extension is not
thread safe (caused by the Microsoft Library used to create the
extension). Use CGI or FastCGI to avoid this problem.
- Frank
P.S. I don't have the full thread of this discussion so I might miss some
important
You need one ofe the folowing extensions compied as a shared or static
module:
ODBC (UnixODBC)
MSSQL (FreeTDS)
ODBTP
compiling as a shered module does not require recompile of PHP. You just
need to load the extension with dl() or from php.ini.
- Frank
My domain is hosting through a hosting
Hi Rafi,
You need to install (and configure) the SQL Server Client tools. The
important part here is the 'Client Network Utility' where you create
aliases for host names, protocols and other options.
The default setting for both the SQL server and the client is (in most
cases) to use named pipes
The MSSQL standard mssql extension handles the 'Changed database context'
message correct.
Each query send to the SQL server results in some form of message
returned. This can be either an error message or an information message.
The MSSQL extension uses two ini settings to tell PHP how to handle
You are getting a message from the SQL Server.
If you increase the values of mssql.min_error_severity and
mssql.min_message_severity (default is 10) you will get more messages if
you descrease the value you will get less messages.
- Frank
Adam, Thanks for the suggestions. I don't want to
You need to install the MSSQL Client Tools or alt least copy ntwdblib.dll
from the SQL Server (this will allow connections but not configuration).
- Frank
I have the php_mssql.dll in the extension directory but when I execute a
PHP page, I am told that the dll does not exist. This is on
http://gtk.php.net
- Frank
Hi there everyone,
I need to produce a system which uses databases but NOT on a webserver,
I
heard something about a PHP distro that is being developed which acts
like
an executable, does anyone know anything of this?
Any help would really be
.
-- Forwarded Message --
Date: Thursday, February 05, 2004 04:19:56 PM -0800
From: Frank M. Kromann [EMAIL PROTECTED]
To: Chris Payne [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] PHP Standalone?
http://gtk.php.net
- Frank
Hi there everyone
I'm guessing that you are using PHP as ISAPI or Apache module and that
might not always work with the MSSQL extension. The library (ntwdblib.dll
from Microsoft) used for this extension is not thread safe. If you switch
to CGI or FastCGI you will not have these problems.
- Frank
Stuart wrote:
mssql_get_last_message() gives me the message:Changed database
context to 'thedatabasenameisprintedhere'.
What the heck is going on here?
Frank M. Kromann wrote:
Hi,
Any table that starts with # is a temp table. You can use
create table #mytemp (...) or you should be able to use
On Tue, 2003-12-16 at 17:29, Frank M. Kromann wrote:
Hi,
Any table that starts with # is a temp table. You can use
create table #mytemp (...) or you should be able to use the query you
suggest. You just have to make sure you have enough space in tempdb
(a
system database)
- Frank
Hi,
Any table that starts with # is a temp table. You can use
create table #mytemp (...) or you should be able to use the query you
suggest. You just have to make sure you have enough space in tempdb (a
system database)
- Frank
Hi all,
I've been handed a query which I'm trying to get to
Hi,
When you have the PHP sources extracted from the tar-ball you can use
configure --with-mssql,shared
make
Then you can copy the mssql.so file to your current php installations
extension dir and either load the extension form php.ini or with the dl()
function.
This way tou don't have to
Hi,
It is also described in the documentation at http://php.net/mssql.
- Frank
Thanks Jeff, I'll look into FreeTDS.
Matt
[EMAIL PROTECTED] wrote:
you can use freetds (http://freetds.org) i think there is even an
rpm...
Then you just use the mssql_* functions built into php
hth
Hi Tom,
What you need to get the instalation to work is these:
php.exe (CGI version)
php4ts.dll
php_mssql.dll
php.ini
in the same directory. I know you can make many different combinations of
files and directories but this minimum will work. You can aslo also add
php4isapi.dll if you want to
The problem is the Sybase extension. It defines some mssql_* functions, and
these will conflict with the mssql_* functions defined by the MSSQL
extension.
You can either use the Sybase extension alone and use both Sybase_* and
mssql_* functions, but then there will be no support for the special
Hi,
When the MSSQL extension is used on *nix systems (compile PHP using
--with-mssql) you can actually fetch char/varchar columns up to 8000
bytes. UNICODE data is supported, though I have not thested nchar,
nvarchar and ntext yet.
The MSSQL extension also includes support for storred
Hi,
This is caused by missing dll's. You need to install the client tools from
MSSQL Server on your PHP box. You can also copy ntwdblib.dll from
winnt\system32 on the SQL Server to the same directory on the PHP box. If
you want to be able to create custome configurations of the client you
need
Hi,
The easy way is to use the mssql functions in PHP. You can see how to
configure PHP with these in the online manual: http://www.php.net/mssql.
You need to download and install FreeTDS (http://freetds.org).
You can also use the online manual to get samples on how to execute stored
procedures
That depends on your backend. Some database systems uses \ to escape '
others uses '. In the last case use
$value = str_replace(', '', $value);
- Frank
Don't. addslashes() instead.
Chris Mach wrote:
does anyone know how to strip a ' from a string? It's causing errors
for my
sql
Mssql server has a list of tools you can use for this. When you create the
database (or later modify it through Enterprice Manager) you can specify
'Auto Shrink'. This will make sure the file sise is optimized when you
delete data.
This cal also be done with this call:
sp_dboption('database',
Hi,
You can't split a transaction between multiple calls to mssql_query. The
memory used (in the server and client) are cleared between each call.
You would have to create a batch of statements and execute these with one
call to mssql_query.
- Frank
I have an opened connection to MS SQL
Frank,
--- Frank M. Kromann [EMAIL PROTECTED] wrote:
This should be ok. --with-tdsver=4.2 sets the
default.
I figured as much, since I think the default can be
overridden in the 'freetds.conf' and/or $TDSVER
environment variable, no?
Have you tried the tsql tool to see if you can
Hi Alan,
I'm not sure what 'Control Panel PHP script' means ?
What version of FreeTDS are you using ?
Do you use the sybase or the mssql extension in PHP ?
- Frank
Hello,
Because I am not sure if this is just a PHP issue or a
PHP+DB issue, I will be posting this message
(seperately) to
Hi,
selectting XML data forces the result to be returned a a unicode text
field. That is not suported by the DBLIB library (From Microsoft) used to
build the mssql extension does not support that.
You can use ODBC or you can wait untill I have a working compy of FreeTDS
on Win32. FreeTDS is
,
--- Frank M. Kromann [EMAIL PROTECTED] wrote:
I'm not sure what 'Control Panel PHP script' means ?
I meant the PHP page itself that is the Control Panel
(i.e., 's_controlpanel.php')
What version of FreeTDS are you using ?
0.60 on the new server; I am not sure about the
currently working
Hi,
php_mssql.dll is for win32 only. This seams to be a *nix installation. In
order to use the MSSQL functions yoy will need to compile PHP using
--with-mssql (or if your PHP version is 4.3.0 --with-sybase). In both
cases you also need to download, compile and install FreeTDS
(www.freetds.org).
Hi
With PHP 4.3.0 you can use --with-mssql (it looks for freetds in
/usr/local/freetds by default). Then you can use the mssql.* settings in
php.ini. When you compile using --with-sybase you would have to use the
sybase.* settings in php.ini, as that is the extension you would be
using.
You
According to the specs for ODBC (and SQL92) it is ok to return -1 for the
number of rows, as the correct number might not be available until the
last row has been fetched.
- Frank
[EMAIL PROTECTED] wrote:
Hello everyone,
We are running an old database system called db/c and attempting
Take a look at the documentation:
http://www.php.net/manual/en/function.mssql-execute.php
- Frank
Hi gurus,
I am new user to PHP.
Does anyone here work with SQL server with PHP, please show me some
codes about how to call a stored procedure in a SQL Server Database.
how to add
Hi,
When you use single quotes to define your strings php variables will not
be replaced.
Try
$message = ...$customer..;
You will have to escape all double quotes used in the string (\) or use
single quote.
- Frank
This is where I am stuck, I can not get the variables to be placed in
to
Take a look at the documentation at
http://www.php.net/manual/en/function.mssql-close.php whhere it says
mssql_close() will not close persistent links generated by
mssql_pconnect().
connections created by mssql_pconnect() will only be closed when the PHP
process terminates.
- Frank
I've
Hi,
It is true that FreeTDS works with MS SQL Server, but I think you need a bit more info:
Sybase and MS SQL Server used to be the same product back when 4.x was released. Then
Microsoft released 6.0 including a set of C libraries and everything was fine.
Microsoft has not released new
Hi,
A new function 'debug_backtrace()' will be available in PHP 4.3.0. This function will
print a list of all the functions called.
- Frank
Yeah, I understand what your asking. I don't know of any method to get the
line number a function was called on, from within the function.
You may
You can actually control this on the fly.
odbc_binmode($iRecordSet, 2);
odbc_longreadlen($iRecordSet, 4096);
$str = ;
while ($temp = odbc_result($iRecordSet, COLUMN_NAME))
$str .= $temp;
This will set the block size to 4k and when you fetch data until the entire column has
ben
, or the Query Analyzer doesen't use this db-lib,
bye,
Chris Mackenzie wrote:
Frank M. Kromann wrote:
Many thanks Frank, changing from varchar to text did indeed fix the
problem.
On reflection, I do now remember reading about this on another mailing
list, it's a pitty my memory failed
Hi,
IBM DB/2 uses Call Level Interface (CLI) for communication between clients and server.
The ODBC driver from IBM is a simple one to one wrapper arround CLI, as CLI and ODBC
share the same specifications.
Using ODBC will give you an extra layer though. On *nix platforms you can compile usen
Hi Jerry,
You need to have the Client Tools for MS SQL Server installed on your PHP4 box. These
tools is found on the CD, or you can just copy ntwdblib.dll fom one system to another.
The default communication protocol will be netbios, if you want to change that to
tcp/ip you need to install
You can download binaries (from latest cvs) from http://kromann.info/php4.php
I'm not compiling all binaries at this point, but this page is updated every morning
at 4am.
If you want to compile it your self you need MS Visual C++, some libraries (gd, jpeg,
png, ttf etc.) some patients.
-
The bug as you call it is a limitation in the libraries from Microsoft. SQL Server
ships with a set of C-Libraries called DBLIB, and these were developed for MSSQL
Server 4.x and 6.x. In version 7.x Microsoft extended char and varchar column max
length to 8000 but did not update the DBLIB
Hi,
Depending on the database you are selecting from you could do it in one select like
this:
select category, count(*) from $table group by category order by category;
- Frank
How would you get the count of each category?
Like this - http://www.scriptsearch.com
Would you have to run
This problem has just been fixed in CVS.
- Frank
Hello!
How can I force PHP to fetch datetime field i 'mmdd hh:mm:ss' WITHOUT
using MSSQL query like *SELECT convert(varchar,dtfield,20) as 'dtfield'* and
so on?
I have a few tables on MSSQL with the different structures and some of
Hi
Try to remobe 'DNS=' from the connect
$conn=odbc_connect(dnsname,userid,password);
should do the trick.
- Frank
Hi:
I'm trying to establish a connection with SQL 7.0.
My system runs W2000, Apache, PHP4. I created a DNS odbc file (with MS
Access) and checked that the connection
Yes, I have. I think I got the ODBC driver from MDAC 2.6 (available from
www.microsoft.com/data), but you will also get it by installing other Microsoft
products (Access or Office).
Depending on the version of SQL Server you use you can get improved performence by
ysing the native MSSQL
Hi Adam,
Host name should not include the port number. If you need to use a non standard port
number you should create a client configuration (using client network utility) and
then use the name of the configuration as the host name.
- Frank
I have PHP running on Apache for win32. The
Hi All,
Microsoft SQL Server used to be identical with Sybase (back arround version 4.xx).
This makes it possible to use the sybase extension (using FreeTDS) on a *nix box to
talk to a SQL Server on a NT/2000 box.
Due to product development SQL 2000's db-library is no longer 100% compatible.
Hi Michael,
The should not be any issues with the oder of the columns in the select using ODBC. I
do have some questions for you.
1) What is the reson for using stored procedures for this. The procedure you are
showing is just a wrapper arround a SQL statement. You could as easily generate
Hi,
I would like to begin learning ODBC. Will I be able to set this up on my
single local machine?
The ODBC functions are build in when you are running PHP on a Windows Box. If you are
running on a (nix box you have to compile PHP with support for ODBC.
Also, What about connecting to MS
Hi Brad,
Your parameter is named $title and you are converting a variable called $input to an
array.
You could catch this type of errors if you change the setting for error_reportiong in
php.ini.
- Frank
can somebody help me with the following code:
function multi_word($title) {
What version of php are you using ?
Handling of binary data from MSSQL Server was changed from php4.0.5 to php4.0.6.
As far as I can tell You should not have any problems with php4.0.6
- Frank
I am preparing a report for a database at my company that will be shown on
the web. It has
Hi,
Query Analyzer perfectly.
e.g.
SP1: (works)
CREATE PROCEDURE SP1 AS
insert into mytable values(...)
select * from mytable
Only one result set.
SP2: (doesn't work)
CREATE PROCEDURE SP2 AS
select * from mytable
select * from mytable
Two result sets
SP3: (doesn't work)
Hi,
You will need to configure the character translation in the Client tools. Open Cleint
Network Utility (on the web server running php) and select the DB Library Options
tab. There you can enable and disable Automatic ANSI to OEM convertion.
If you are using the ISAPI version of php you
MSSQL does not have complete the same functions. You can use SELECT TOP 10.
You could also define mssql.batchsize in php.ini. This way php only reads the
specified number of rows. You can the use mssql_fetch_batch() to read batches of data
on the same query.
- Frank
Hi,
Having used to
74 matches
Mail list logo