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 p
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 t
Sounds like a permission problem. Make sure the IIS user (IUSR_) 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.
>
> I ha
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
> l
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.c
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!
>
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 ha
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
>
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 * FR
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 wi
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 scri
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 availabl
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
> (u
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. This
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 approve
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 que
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
> data
mssql_field_type() is the function for that.
- Frank
> Robert,
>
> Do you have an example of pulling the Column types from an MS Sql query?
For example: select top 1 * from mytablename.
>
> loop thru the fields in the recordset and print out their data types?
>
>
> --
> Gerardo S. Rojas
> ma
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 inform
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 i
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 W
an advantage (unless
> you want to use mod_perl), but in a standalone environment i think that
> perl will serve you better.
>
>
>
>
> -- Forwarded Message --
> Date: Thursday, February 05, 2004 04:19:56 PM -0800
> From: "Frank M. Kromann" &
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
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:
>
gt; Thanks,
> Matt
> 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
at I understand no special rights are
> needed to create a temporary table.
>
> Using mssql_get_last_message() gives me the message:Changed database
> context to 'thedatabasenameisprintedhere'.
>
> What the heck is going on here?
>
>
>
>
>
> Fra
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 recom
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
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 use
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 ms
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 procedures
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 to
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 a
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', 'au
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
>
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 Serve
rank
> Hi 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
&
t; Hi Frank,
>
> --- "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 versi
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 devel
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)
Hi Gunther,
there was an error in the mssql.php file. I have just fixed that in cvs.
Change line 161 from
$ar = @mssql_fetch_array($result);
to
$ar = @mssql_fetch_array($result, MSSQL_ASSOC);
And it will work on your system
- Frank
> I have a problem with PHP 4.3.
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 shoul
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 attempti
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 writ
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
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 version
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 fetc
e the max
> data-length returned by a field on the fly, so there must be some
> settings, or the Query Analyzer doesen't use this db-lib,
>
> bye,
>
> Chris Mackenzie wrote:
>
> >"Frank M. Kromann" wrote:
> >
> >Many thanks Frank, changing f
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 th
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.
- Fran
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 stu
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
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 som
If your storred procedure returns a result set you can get it with the mssql_functions
as well.
If the precedure returns values or output parameters you will need php 4.0.7 (or
current cvs). The updated version of php_mssql.dll includes three new functions aimed
for storred procedures.
- Fran
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
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 extens
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 mssq
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. Th
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 the
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) {
>
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
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 sev
Hi,
I would suggest removing @ in front of the sybase_query. This way your code will
produce warnings and messages from the server. That could help you debugging. You
could also try to execute the query in Query Analyzer on the SQL Server.
- Frank
> Please take a look into my simple php code.
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: (
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 wi
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
The MSSQL extension works fine with SQL Server 6.5, 7.0 and 2000.
What type of errors are you getting ?
- Frank
> Why the mssql_connect don't function with mssql server 2000 ?
>
> Bye
> Gian Luca
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL
ODBC and ADO uses the same type of connection. In fact you need an ODBC DSN to connect
to a database using ADO.
The MSSQL functions in PHP uses a native communication with the database. This
communications is faster than using ODBC but it is not as easy moving to other
databases as it would be
wyoy could use a SQL statement like this:
select * from myTable where LastName like "A%"
- Frank
> Guys,
>
> How to view the result from the table.
> If I only want to display persons begin with letter A in the front.
>
>
>
> _
> w
81 matches
Mail list logo