Re: [PHP-DB] Efficient way to access MS SQL server
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 platforms. - Frank There's a limit of 30 characters for column names, but only if you connect to your mssql server from windows (more info on http://hu2.php.net/mssql). The native SQL driver for PHP has a problem with a limit on the number of characters in a string, so can't use that. I'm not sure what Charly means by this though... Evert -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] How do I use chunks for nText fields?
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 MS SQL server database, using odbc_exec() and related methods. Some of the database fields are type nText, and return only part of the field value plus a pointer to the next part. My database guy pointed to a Microsoft example of how to deal with in VB using the GetChunk method within a while loop: http://msdn2.microsoft.com/en-us/library/aa905922(SQL.80).aspx I have two problems with this approach: 1) It seems a rather awkward way to do it 2) I can't find any documentation describing how to do it in PHP Can anyone tell me what I need in order to get the whole value of the field out? (I haven't been able to subscribe to php-db, so please CC me.) Cheers, Dave. -- David Balch. | Señor web developer. T: +44 (0)1865 280979 | Technology-Assisted Lifelong Learning. F: +44 (0)1865 280982 | University of Oxford. E: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Connecting to MS Access Database using PHP via ODBC.
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. I have mapped a network drive to where the database is stored and have used it when creating the System DSN. The problem is the the php script cannot connect. If I move a copy of the database over to the server where IIS is installed and update the System DSN to point to that it all works fine. I was made aware that you could have the database on a different machine and it would work, but this doesnt seem to be the case. Can anyone shed some light on this? Many thanks. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: MSSQL Server
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 Operating System, you can install FreeTDS package to connect MSSQL Server.:) -- Haydar TUNA Republic Of Turkey - Ministry of National Education Education Technology Department Ankara / TURKEY Web: http://www.haydartuna.net Dan Shirah [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I cannot connect to my MSSQL server. I use the following connection string: php: -- $connection = mssql_connect http://php.net/mssql_connect('server','user', 'password') or die ('server connection failed'); $database = mssql_select_db http://php.net/mssql_select_db(database_name , $connection) or die ('DB selection failed'); ? -- The MSSQL server is setup to use Windows and Server Authentication. I have a *local* dummy account setup for testing and when using this account I can connect with no problems, but when I try and use my domain/network account I cannot connect at all. (my network account has full access to the server, database and tables) I can even login to the SQL Management Studio using Windows Authentication and my network account, but still cannot connect using PHP. Any ideas? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Problem with PHP 4.4.4 and MSSQL in Centos
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! I've stepped into an annoying problem when trying to fetch the tuples returned by a stored procedure in a MSSQL database from a PHP program running in a Centos Linux server running PHP 4.4.4. The stored procedure returns an arbitrary number of tuples, and my code is only working when the SP returns one row. The code I'm using, simplified, follows: $db_conn = mssql_connect (server, user, passwd); mssql_select_db(db,$db_conn); $query = Exec stored_procedure '$par1', '$par2'; $result = mssql_query ($query); while ($row = mssql_fetch_array ($result)) { echo $row[COL1]; echo br/; } If stored_procedure () returns only one row, the code executes without any problem. However, if there are more than one rows to be returned, the program not only blocks, but also eats all the server's memory. I've run this program also in Ubuntu with PHP 4.4, and it works without any problem, so I'm thinking it may be either a configuration problem of the centos server, or a bug in the PHP version. Do you have any hint to solve this? I would appreciate any advice. Thanks in advance, Claudio -- Claudio Saavedra [EMAIL PROTECTED] - La informacion contenida en esta transmision (y sus documentos adjuntos), es confidencial y no puede ser usada o difundida por personas distintas a su(s) destinatario(s). El uso no autorizado de la informacion contenida en esta transmision puede ser sancionado criminalmente de conformidad con la ley chilena. Si ha recibido esta transmision por error, por favor destruyala y notifique al remitente. Atendido que no existe certidumbre que el presente mensaje no sera modificado como resultado de su transmision por correo electronico, nuestra empresa, no sera responsable si el contenido del mismo ha sido modificado. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Problem with PHP 4.4.4 and MSSQL in Centos
Hi Claudio, bugs.php.net would be the place to report the bug. As both the MSSQL and Sybase extensions are using the same FreeTDS library I would think the bug is in the Sybase extension. You will get more mssql_* functions with the MSSQL extension, and much better support for storred procedures 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 version) No differences. 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) I fixed it by compiling again php with --with-mssql instead of --with-sybase. Now it works perfectly. Thanks for your suggestions. Anyway, I wouldn't expect php to hang and kill my server if compiled with --sybase. Maybe just a runtime error would be ok, but a hang like that, it's a bug to me. I would gladly report it, if I knew where should I. Do you think it may be in freeTDS or PHP itself? I am not really into PHP internals. Best regards, Claudio -- Claudio Saavedra [EMAIL PROTECTED] - La informacion contenida en esta transmision (y sus documentos adjuntos), es confidencial y no puede ser usada o difundida por personas distintas a su(s) destinatario(s). El uso no autorizado de la informacion contenida en esta transmision puede ser sancionado criminalmente de conformidad con la ley chilena. Si ha recibido esta transmision por error, por favor destruyala y notifique al remitente. Atendido que no existe certidumbre que el presente mensaje no sera modificado como resultado de su transmision por correo electronico, nuestra empresa, no sera responsable si el contenido del mismo ha sido modificado. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Php 5 and Mysql on Windows
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 to be very careful that I don't accidentally let one get into the Windows folder, becuase that is search first The manual lists the search order. It also has some notes on setting up IIS and where to put the php5isapi.dll so it is found Niel -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] SQL Server COM question
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 Firebird so they will work with SQL Server (their request; not mine). Is there a reference where I can get the COM Methods and Properties? The php website maybe? http://php.net/com Also, without loading the large AdoDb library, is there a Prepare() method if I use the $db = new COM(ADODB.Connection) connection? If you want to use adodb methods, you need to load it all up properly, same as anything else. I checked the http://php.net/com site initially and there is a couple of examples, however there is not a list of all COM methods and properties for SQL Server. Does anyone know where such a list might exist? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] LIMIT
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 aTable LIMIT 5 will return 5 rows. Is there a way to find out that 100 rows would have been returned if there was no LIMIT clause, by using only Query #2 and maybe a PHP function on the $result? Regards, Dwight -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] RE: Problem installing mssql extension
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 scripts. It's even better to install the MS SQL Server Client libs. These are fouind on the MS SQL Server CD. This will install the Query Analyzer that can be used to check the connection, but it also installs tools that lets you configure the default protocol (NetBios is default if you don't install these) and create Server aliases. - Frank mssql has a dependency on mysql. Go figure. MySQL has some dependencies, also, although they are a little easier to find info on and do not require installing other extensions. If you have the PHPRC system path set to your Windows PHP directory, you should be OK. Otherwise you may have to copy some additional files to the system32 directory. -jim -Original Message- From: Andrew Kleimeyer [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 24, 2006 10:56 PM To: php-db@lists.php.net Subject: Problem installing mssql extension I've read all the documentation, and tried every suggestion, but I'm still unable to run the mssql extension. When I uncomment the line in php.ini, PHP crashes. My system: Windows 2000 IIS 5.0 PHP Version 5.1.2-dev What I have tried: I've placed the ntwdblib.dll that came with php into the winnt/system32/ directory. Nothing. I've placed the ntwdblib.dll that is running on my mssql machine into winnt/system32/ directory on the php machine. Nothing. I've copied the php_mssql.dll into the winnt/system32/ directory on the php machine. Nothing. Any ideas would be greatly appreciated. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Problem installing mssql extension
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 with you about keeping installations simple. I don't even use an extension dir. Everything works nicly with all PHP files installed in c:\php5 (c:\php4 and c:\php6). Your research on MSSQL depending on MySQL is wrong. As the maintainer of the MSSQL extension I know for sure that it depends only on dblib from Microsoft. - Frank You still need to set the PHPRC system variable to c:\php5 (on the System Properties menu, Advanced tab, click Environment Variables). Also, PHP4 has an extensions directory. PHP5 should point to extension_dir = C:\PHP5\ext\ PLEASE NOTE that I disagree with Frank that the correct methodology is to pollute system32 with all of your PHP DLLs. This makes maintenance harder. All of my dll's live in the C:\php tree, so when I swap to the next 5.1.x release, I don't have to go hunt down a bunch of random dll's in system32. When I tried to run only the mssql extension, I kept getting a php startup error that it was Unable to load c:\php5\ext\php_mssql.dll. I knew that the file was there, why couldn't it be opened? I researched this (sorry, lost the link) and found that mssql extension has a dependency on the mysql extension. So then I was getting Unable to load c:\php5\ext\php_mysql.dll. That's when I learned that it's best to set your PHPRC System Variable to load the required dll's directly from the php5 directory tree, rather than copying them to system32. This should be especially useful to you as you are running 5.1.2-dev, as these dll's may change with the stable release. -jim -Original Message- From: Andrew Kleimeyer [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 24, 2006 11:21 PM To: Bastien Koert Cc: php-db@lists.php.net Subject: Re: [PHP-DB] Problem installing mssql extension Yes. My extensions directory is c:\php\extensions and I'm already successfully running the mysql extension. On 1/25/06, Bastien Koert [EMAIL PROTECTED] wrote: Have you added the path to the extensions in the path/dir section to point to the extensions directory? ext_dir = c:\php5\ext; bastien From: Andrew Kleimeyer [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] Problem installing mssql extension Date: Wed, 25 Jan 2006 12:56:09 +0800 I've read all the documentation, and tried every suggestion, but I'm still unable to run the mssql extension. When I uncomment the line in php.ini, PHP crashes. My system: Windows 2000 IIS 5.0 PHP Version 5.1.2-dev What I have tried: I've placed the ntwdblib.dll that came with php into the winnt/system32/ directory. Nothing. I've placed the ntwdblib.dll that is running on my mssql machine into winnt/system32/ directory on the php machine. Nothing. I've copied the php_mssql.dll into the winnt/system32/ directory on the php machine. Nothing. Any ideas would be greatly appreciated. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php_mssql - 'space' instead of empty string
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 available under php5) but the problem could be fixed there. Just replace php_mssql.dll with php_dblib.dll. You can download a copy from my site (http://kromann.info/php.php). - Frank I've found that since PHP 4.3.4 many people had problems with MSSQL extension. PHP developers are saying that is problem with MS libraries, and there is no possibility to fix it in PHP: http://bugs.php.net/bug.php?id=29292edit=1 http://bugs.php.net/bug.php?id=26315edit=1 Right now I'm using PHP 4.4.0, and still have problem with it. I understand that php_mssql binaries are compiled using ntwdblib.lib, and that very library is causing trouble, am I right? Is it possible to recompile php_mssql with old version of ntwdblib.lib (used in PHP 4.3.3) without negative consequences (memory leaks, unstability, whatever)? Or using old PHP 4.3.3 is the only solution? -- Bartosz Jakubiak -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Connecting to SQL Server
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 (uh!). The name of the server is 2k-server, but I am not sure where to create the ODBC connection. Some of the docs state that all I need is ?php $connection_string = 'DRIVER={SQL Server};SERVER=2K-SERVER;DATABASE=Php_Test'; $user = 'sa'; $pass = 'MyPassword'; $connection = odbc_connect( $connection_string, $user, $pass ); ? However that gives me an error: Warning: SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect in /home/httpd/test/odbc/php/connect.php on line 8 Any suggestions on the best way to connect? Todd -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP Bug handling Messages from MSSQL ?
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 will only be available in PHP 5 as PHP 4 is closed for new features. - Frank Hello, I'm trying to build a demo of SQL Injection (SI) to discuss with my students. The idea is to use the live demo to show and discuss how to avoid SI using some secure code techiques. I'm using PHP 4.3.11 and MSSQL 80 on a windows XP box. Sometimes a multiline query is submitted to the server, something like this: use sales; select name from users; drop table xxx; Note the query above has in fact three queries, each one producing a message but the function mssql_get_last_message() aparently doesn't return all of them to the user. Capturing the packets during the connection (e.g ethereal or tcpdump) I can perfectly see all messages returning from the server, like this: --- (1) Changed database context to 'sales' (2) result set here (3) Cannot drop the table 'xxx', because it does not exist in the system catalog. But only the first message is returned from PHP mssql_get_last_message(). Can anyone help me to explain this behavior ? Thanks in advance. Denio. ... Denio Mariz Teacher, CEFETPB Researcher, GPRT/UFPE, Brazil -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP/MySQL with Javascript
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 submit a form to add an item to their cart that Javascript can pickup the PHP Value of whether people are logged in or not. I don't really need code as I don't want to take anyones time up, but if someone could point me in the right direction of how I can use PHP Values in Javascript I would REALLY appreciate it. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Having a DUH Moment with mysql_fetch_array
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. I've verified that my SQL is indeed returning the correct value for $key, but when I go to fetch the array for the row so that I can extract the pertinent tidbits of information from that row, I get nada. My troubleshooting echo statements give me the following out put. I've included the actual snippet of code below. 54 SELECT * FROM jobs WHERE pk_job = '54' Resource id #4 Array 0 //use the date to find the record we're looking for approved but not yet posted $findkey = SELECT pk_job from jobs WHERE (display = 'Yes') AND (approval_stamp = '$matchnow') AND (posted IS NULL); list($getkey) = mysql_fetch_row(mysql_query ($findkey)); $key = ($getkey); echo $key; //note this is returning the correct and expected value echo br; // now that we have the key lets get the row $query = SELECT * FROM jobs WHERE pk_job = '$key'; echo $query; //note this is apparently behaving correctly and gives me a correct result when executed from the command line echo br; $result = mysql_query($query); echo $result; echo br; //make array $row = mysql_fetch_array ($result); echo $row; I'm pretty sure that this is a DUH! moment, but I'm not sure quite what it is that I've done. I copied the code from another thing that I wrote a while back that's working fine and only changed SQL statements to reflect their new purpose in life. TIA, Jimi If computers get too powerful, we can organize them into a committee -- that will do them in. -- Bradley's Bromide -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] where can i get fixed mssql extension??
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 (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] IIS/PHP question
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: Tue, 16 Nov 2004 11:16:40 -0500 I'm having a weird issue with sessions on IIS running PHP. I was finally able to use sessions on IIS by setting the save_path to /temp and that seems to work. However, I can register a variable using session_register, but when I go to the next page, it doesn't seem to see the session varaible even though i've got session_start() called on the top of that page. Is there a bug with IIS and php sessions? thx in advance Adil. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] IIS and php sessions
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 to migrate this php app with a mySQL database to IIS/Microsoft SQL Server. I know that I should be using a database abstraction layer but haven't had the time to do that just yet. In anycase, the question has little to do with that. I'm trying to get sessions in php working on IIS and I've noticed that that needs to be configured manually for IIS. But what exactly does that mean? I can't find a good step by step source about this issue so any help would be greatly appreciated. thx Adil. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Debian mssql_init
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 news:[EMAIL PROTECTED] the mssql_connect function work right, but php give me back this message when I try mssql_init: Fatal error: Call to undefined function: mssql_init() in /var/www/eurogsmtest/test.php on line XX Shouldn't you use mssql_init() in a mssql query, not in the body of the php script? I can't say that this works, but I'd go for something like: $link = mssql_connect; // This sets up your SQL link. $sql = mssql_init(); // This is the SQL command you'd like PHP to run for you $result = mssql_query($sql, $link); // If $result = FALSE, there was a problem. Otherwise, it worked. -P -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Multiple MSSQL Connections
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 database. At the same time I have sessions being recorded to another SQL 2000 database. Could these two database connections being open at the same time cause an access violation by php on a windows 2003 server? Thanks, Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: SQL Server Query Failed
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 information about your setup. Bruno: I did that. I had to wait a bit until it failed again, whcih it did a few moments ago. Alas, there is not one thing out of the ordinary in the log. Any other suggestions? THANK YOU! david Bruno Ferreira [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] david wrote: Hello there! I have just about driven myself crazy with an odd intermittent problem. [snip] I'd first start by turning on all logging I could in the SQL server so that I could see what's happening straight from the horse's mouth... Bruno Ferreira --- [This E-mail scanned for viruses by Declude Virus] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Accessing MS SQL from Linux
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 company on Linux with PHP 4.3.4. Hosting company is not open to re-compile PHP for using FreeTDS or any other application. If I can not use FreeTDS, what other options do I have? a) Can Pear be used? It is 4.3.4. I tried ?php required_once(DB.php) ? but got error. b) Can ADODB be used without re-compiling PHP? Any other option? Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MS-SQL server connection
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 for the connection, but if the server and the client uses different protocols you will not be able to connect without creating an alias. - Frank I am trying to create a connection w' MS-SQL Server to use with php. I have the server name (on our LAN) and my UID PWD (work via MS-ODBC driver for Access db). However my php is failing to bring any data back (unknown host). Any suggestions if I am missing any parms? [I am a newbie so plz be gentle :) ] Rafi This e-mail, including attachments, may include confidential and/or proprietary information, and may be used only by the person or entity to which it is addressed. If the reader of this e-mail is not the intended recipient or his or her authorized agent, the reader is hereby notified that any dissemination, distribution or copying of this e-mail is prohibited. If you have received this e-mail in error, please notify the sender by replying to this message and delete this e-mail immediately. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MS SQL 'Changed database context' error
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 these messages. If a message from the server has a severity equal to or higher than the setting in php.ini, PHP will create a warning or an error (stop processing the script). The default setting for both parameters is 10, and that should give a smooth execution of most PHP scripts. For debugging you might want to lover these values. (And this is not what I said in an earlier post but I was wrong then. This time I checked it :-)) 'Changed database context' has a severity = 0. This will only be handled by PHP if mssql.min_message_severity = 0. The mssql_get_last_message() function will always return the last message from the server. This function should not be used to check for errors. The function is intended to give the programmer a tool to fetch the message if an error is detected. - Frank Hi Robert, I've seen your name on a few of the ODBTP posts. You're one of the developers of same, yes? Are you familiar with the 'Changed database context' message? Do you know for sure that ODBTP handles that correctly? Thanks. Michael -Original Message- From: Robert Twitty [mailto:[EMAIL PROTECTED] Sent: Thursday, February 19, 2004 5:38 PM To: Michael Flanagan Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] MS SQL 'Changed database context' error Hi Michael You might get better results using the odbtp extension with support for the mssql functions. Since you are using Windows, use php_odbtp_mssql.dll instead of php_mssql.dll. -- bob On Thu, 19 Feb 2004, Michael Flanagan wrote: Adam, Thanks for the suggestions. I don't want to ignore all error handling. Later, I might get an error that I really don't want php to swallow due to either of your suggestions. Has anyone else run into this and solved it? Any idea why the following lines in the php.ini file don't work? mssql.min_error_severity = 11 mssql.min_message_severity = 11 Michael -Original Message- From: Adam Voigt [mailto:[EMAIL PROTECTED] Sent: Thursday, February 19, 2004 12:44 PM To: Michael Flanagan Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] MS SQL 'Changed database context' error Try putting the error suppressor (@) before the query, eg: @mssql_query Or, try setting the error reporting: error_reporting(0); On Thu, 2004-02-19 at 14:38, Michael Flanagan wrote: Thanks, Adam. I don't get the error in Enterprise manager. MS has a KB article out that says that this message is informational. I seem to remember that the article also says the message comes out some times, and not other times, but that you should just forget it. The particular SELECT statement I'm getting the message on is the second query in my script. The other query is to the same db; in fact, it uses the exact same $db connection object. Any ideas on getting PHP to ignore this info message? Thanks again. Michael -Original Message- From: Adam Voigt [mailto:[EMAIL PROTECTED] Sent: Thursday, February 19, 2004 12:13 PM To: Michael Flanagan Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] MS SQL 'Changed database context' error This may not be the case, but I've seen this before when the PHP library didn't know how to express MS SQL's error, so it simply returns the last message sent which was the informational context change. If it is infact an error, you should be able to plug the query directly into Enterprise Manager to see MS SQL's take on the problem, so to speak. =) But again, this is all just in my past experience's, yours may differ greatly. On Thu, 2004-02-19 at 14:08, Michael Flanagan wrote: I'm getting the error Changed database context from MS SQL. I see where this is supposedly just an informational message. I've tried setting mssql.min_error_severity = 11 mssql.min_message_severity = 11 but to no avail. What am I missing? I don't mind the message so much, but php treats this as an error, and doesn't execute my query. I'm running php 4.3.3 for Windows; the SQL Server and web server are on the same machine. I'm using PEAR:DB for the database access. Thanks. Michael Flanagan voice: (1) 303-674-2691 fax: (1) 603-963-0704 (note '603' area code) mailto:[EMAIL PROTECTED] -- Adam Voigt [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Adam Voigt [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MS SQL 'Changed database context' error
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 ignore all error handling. Later, I might get an error that I really don't want php to swallow due to either of your suggestions. Has anyone else run into this and solved it? Any idea why the following lines in the php.ini file don't work? mssql.min_error_severity = 11 mssql.min_message_severity = 11 Michael -Original Message- From: Adam Voigt [mailto:[EMAIL PROTECTED] Sent: Thursday, February 19, 2004 12:44 PM To: Michael Flanagan Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] MS SQL 'Changed database context' error Try putting the error suppressor (@) before the query, eg: @mssql_query Or, try setting the error reporting: error_reporting(0); On Thu, 2004-02-19 at 14:38, Michael Flanagan wrote: Thanks, Adam. I don't get the error in Enterprise manager. MS has a KB article out that says that this message is informational. I seem to remember that the article also says the message comes out some times, and not other times, but that you should just forget it. The particular SELECT statement I'm getting the message on is the second query in my script. The other query is to the same db; in fact, it uses the exact same $db connection object. Any ideas on getting PHP to ignore this info message? Thanks again. Michael -Original Message- From: Adam Voigt [mailto:[EMAIL PROTECTED] Sent: Thursday, February 19, 2004 12:13 PM To: Michael Flanagan Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] MS SQL 'Changed database context' error This may not be the case, but I've seen this before when the PHP library didn't know how to express MS SQL's error, so it simply returns the last message sent which was the informational context change. If it is infact an error, you should be able to plug the query directly into Enterprise Manager to see MS SQL's take on the problem, so to speak. =) But again, this is all just in my past experience's, yours may differ greatly. On Thu, 2004-02-19 at 14:08, Michael Flanagan wrote: I'm getting the error Changed database context from MS SQL. I see where this is supposedly just an informational message. I've tried setting mssql.min_error_severity = 11 mssql.min_message_severity = 11 but to no avail. What am I missing? I don't mind the message so much, but php treats this as an error, and doesn't execute my query. I'm running php 4.3.3 for Windows; the SQL Server and web server are on the same machine. I'm using PEAR:DB for the database access. Thanks. Michael Flanagan voice: (1) 303-674-2691 fax: (1) 603-963-0704 (note '603' area code) mailto:[EMAIL PROTECTED] -- Adam Voigt [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Adam Voigt [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP and php_mssql.dll
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 Windows XP Professional. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP Standalone?
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 appreciated :-) Chris Payne -- [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] PHP Standalone? (fwd)
Take a look at http://gtk.php.net/apps. Lots of references to code that will work on both *nix and Win32 systems. - Frank Hi there, Unfortunately I don't know much Perl at all ATM, and I've suddenly has this job arise that needs me use an ACCESS Database (Yuck) but in a windows-style interface and NOT web, so I have been looking hard to try to find information on whether I can create an interface for 2000/XP that can control and receive results from PHP. If you have any tips I would be really appreciative :-) I just download PHP-GTK. Chris Payne -- [EMAIL PROTECTED] [EMAIL PROTECTED] -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, February 05, 2004 7:30 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] PHP Standalone? (fwd) while php can be set up to do what you're after, i think that perl would be a better choice. while i use both php and perl, i think that perl is a much stronger general scripting language. if you need [web]server parsed pages, then php has 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 [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 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 appreciated :-) Chris Payne -- [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- End Forwarded Message -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MSSQL stability problem
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: Robert Twitty wrote: Maybe you are running out of connections. The max connections settings in both php.ini and SQL Server are set to unlimited. Is there another limit I am not aware of? I am now closing the connection to MSSQL at the end of every page and it still does it. I've restarted SQL Server (no change) and then the whole machine but it still does it. The connection closing is working because I see no connections to the database in the SQL Server process list. Is anyone using MSSQL with PHP on Windows? Can anyone help... please... :/ -- Stuart -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Creating temp tables in MSSQL
Hi John, you need to specify a name for the column that you create with the convert function. Like this select distinct convert(varchar(36), amount) id into #temp1 from fred #temp1 will now have one column called id. #temp1 can be removed with droptable #temp1 or by closing the connection to the database. - Frank Thanks for your response Frank, but this is still driving me nuts and making me look like a moron at the same time (-: This simplified query: $query = SELECT distinct convert(varchar(36),a.traineeID) INTO #tempdata1; $query .= FROM tblSignIn_trainee a; $queryresult = MSSQL_QUERY($query,$cn) or die (Error in query: $query. .mssql_get_last_message()); does not work. The databases connection which I am using connects with db_datareader rights to SQL Server - from what 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? 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 all, I've been handed a query which I'm trying to get to work. I'm using PHP to talk to MSSQL 7. My question is this: Can I create temp tables with mssql without executing the code in a stored procedure? The simplified version of the query is as follows: $query = SELECT distinct convert(varchar(36),traineeID); $query.= INTO #tempdata1; $query.= FROMtblSignIn_trainee a; Later on I could make a stored procedure, but at the moment I would like to just work with the query directly in the code if at all possible. Thanks, John -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Creating temp tables in MSSQL
Hi Matt, Tables in tempdb are deleted when the connection is closed or when the user deletes them with drop table #tempname. - Frank Hi Frank. When does this table get deleted? when the DB connection closes or does one have to run a process to clear the temp tables? 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 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 work. I'm using PHP to talk to MSSQL 7. My question is this: Can I create temp tables with mssql without executing the code in a stored procedure? The simplified version of the query is as follows: $query = SELECT distinct convert(varchar(36),traineeID); $query.= INTO #tempdata1; $query.= FROMtblSignIn_trainee a; Later on I could make a stored procedure, but at the moment I would like to just work with the query directly in the code if at all possible. Thanks, John -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Matthew Vos Systems Analyst Product Development Techcom Software Solutions Inc. 416.398.5764 [EMAIL PROTECTED] * * * * * * * * * * This message contains information from Techcom Software Solutions Inc. which is confidential and privileged. If you are not an intended recipient, please refrain from any disclosure, copying, distribution or use of this information and note that such actions are prohibited. If you have received this transmission in error, please notify [EMAIL PROTECTED] This message and any attachments have been scanned for viruses. This message has been digitally signed to ensure authenticity. Key ID: CFEA28EC Fingerprint: 009F E13D 0450 55AF DC1C 4D77 1FE9 0DBB CFEA 28EC -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Creating temp tables in MSSQL
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 work. I'm using PHP to talk to MSSQL 7. My question is this: Can I create temp tables with mssql without executing the code in a stored procedure? The simplified version of the query is as follows: $query = SELECT distinct convert(varchar(36),traineeID); $query.= INTO #tempdata1; $query.= FROMtblSignIn_trainee a; Later on I could make a stored procedure, but at the moment I would like to just work with the query directly in the code if at all possible. Thanks, John -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] How To Recompile For FreeTDS + MS SQL Support?
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 recompile any of your existing modules or apache. - Frank I have RedHat 9 and FreeTDS. I used tsql to test FreeTDS and it works great, connecting to my remote SQL 6.5, 7, and 2K servers, accessing pubs.authors. Now I want to connect PHP to it. I seem to be doing something wrong. RH9 ships with 4.2.2, so I went hunting for the file and got php-4.2.2.tar.gz. I expanded this and then followed advice from aissam at yahoo dot com instructions for configuration... http://www.php.net/manual/en/function.mssql-connect.php ...but it wouldn't generate a make file and I got stuck. Do you have any idea where I should go from here? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Linux/PHP with M$/SQL Server
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 Jeff Matt Giddings [EMAIL PROTECTED]To: [EMAIL PROTECTED] clink.net cc: Subject: [PHP-DB] Linux/PHP with M$/SQL Server 11/20/2003 09:40 AM Has anybody been able to bridge a Linux/php setup to a M$/SQL Server database? Is this possible using JDBC or a Unix ODBC connection to the SQL Server? Any pointers in the right direction would be greatly appreciated. Thanks, Matt -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] SQL Server Connect Issues
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 ISAPI version over the CGI version, and any other extensions can be added as needed. In order to load the mssql extension (from php.ini or with the dl() function) you need to install the MSSQL Client Tools on the box running php. These tools can be found on the MSSQL Server CD, or you can simply copy ntwdblib.dll from the SQL Server tp the web server, but this will not install the tools needed to change the configuration! - Frank First, I will admit that I am new to PHP. I'm installing PHP on our Windows 2K / IIS server for some users who want to use it. We also host SQL Server 7 for websites. I'm getting the following error on the server, and on the client's webpages: PHP Warning: Unknown(): Invalid library (maybe not a PHP library) 'msql.dll' in Unknown on line 0 Here is what I have done so far: - I originally installed PHP 4.3.3 on the server using the Windows Installer version. - Uncommented out the extension=php_mssql.dll line inside of the php.ini file. - Figured out that I needed to download the extensions since they weren't included in the Installer version. - Added all of the php_*.dll files to the same directory as the PHP.EXE file. (I've also tried putting these in the WINNT\System32 directory, with the same luck.) - Made sure the msql.dll file is in the same directory as the PHP.EXE file. (Again...tried in the WINNT\System32 directory.) - Made sure the ntwdblib.dll file was in the same directory as the PHP.EXE file. (As above...tried the WINNT\System32 directory.) Originally, I was having problems with an error about the msql.dll file not being found. Once I had it put into place, then the current error message came about, and I have not been able to get it to go away. I've tried about everything I could find on the Internet about this type of error. The strange thing is that it appears to be talking to SQL Server just fine, since the PHPBB program I also installed for one user connected to the database at least long enough to create all of the tables and fields required in the install.php file. I keep seeing information about having to recompile the PHP.EXE with certain settings using FreeTDS, but from what I have gathered, that is only required if running on Linux. (Right??) Any help anyone can give me would be great. Thanks, ~ Tom -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Problems with Sybase and MSSQL
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 mssql functions to handle stored procedures etc. If you can recompile the Sybase extension, you can disable the definition of the mssql_* function aliases and that should solve the problem too. - Frank Well, this is the situation: i have a Win32 server running Apache2 and PHP4.3.2 as a module. I've been working really fine with the Sybase-CT module, and everything went fine till i added MSSQL support. When i restarted apache after changing php.ini it just throw an awfull amount of msg boxes telling registration failed - duplicate name - mssql_connect and so on for every mssql function. At first I thought that php_mssql.dll was being loaded twice, but it wasn't the case. So i started to walk around the problem, but nothing seemed to make it work. At last i came with the idea of enabling only mssql support, so I commented php_sybase_ct.dll and everything worked fine (like sybase_ct worked fine alone). I inverted the situation some times (enabling mssql and disabling sybase, and vice-versa), and everytime it worked great, with only one driver enabled. I know that there are some workarounds for this (in fact, i know that i can connect to MSSQL with the sybase functions, and if it was my code i'll do the trick myself) but i can't give that solution to my client, and odbc isn't viable either. He depends on some third party different apps that use both sybase and mssql. So i'm stucked here, i can perfectly enable and connect to MSSQL or to Sybase, but not both. Any suggestion or tips will be great... Regards, Federico Finos mail2web - Check your email from the web at http://mail2web.com/ . -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MSSQL2000 and PHP
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, through mssql_init, mssql_bind and mssql_exec functions. It is required that you ink with FreeTDS though. - Frank Yes You cannot read varchar(255) data fields. You cannot easily read ntext and nvarchar (UNICODE) fields. No direct support for stored procedures. -- bob On Mon, 1 Sep 2003, Arnaud L wrote: Hi, We have migrate our SQL server to MSSQL2000. Since this migration, we can't connect to MSSQL using PHP (on linux with SybaseCT librairie) Any Issues ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php_mssql.dll
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 install the tools. - Frank I got the following error when I tried to connect to MS SQL server: Unknown () mssql: unable to initialize module Please advise -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MSSQL Procedures
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 and retreive the return values. http://www.php.net/manual/en/function.mssql-execute.php. - Frank Jeson Hi , this is Nabil from PHP list, i wonder if u could help with the following: I have a stored procedure on a remote Microsoft (stupid) SQL server.. and I have to connect to it remotely and I have only permission to execute those specific procedure , and I only got the returned value... My server that I will connect from is Linux, apache with MySQL database, and my code ofcourse PHP How can i connect to microsoft SQL server from my php linux server..??? i think ODBC is not excisted in Linux... ( I reserve to myself to be wrong)... Please help me if I can , how can I connect to that server , and execute them, and get the return values... One of the stored procedures that i got a copy from the remote administrator is : Waiting for any comment / --== === CREATE PROCEDURE ChangePasswd @login varchar(32) , @oldpass varchar(16), @newpass varchar(16) AS declare @chkpass int set @chkpass = (select count(*) from subaccounts where [EMAIL PROTECTED] and [EMAIL PROTECTED]) if @chkpass0 begin update subaccounts set [EMAIL PROTECTED] where [EMAIL PROTECTED] and [EMAIL PROTECTED] select '0' as err end else begin select '1' as err end Go --== === -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] strip
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 statements -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MSSQL Optimize?
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', 'autoshrink', 'true') You can also do this on request. This section is taken from the MSSQL documentation. DBCC SHRINKDATABASE (database_name [, target_percent] [, {NOTRUNCATE | TRUNCATEONLY}] ) Arguments database_name Is the name of the database to be shrunk. Database names must conform to the rules for identifiers. For more information, see Using Identifiers. target_percent Is the desired percentage of free space left in the database file after the database has been shrunk. NOTRUNCATE Causes the freed file space to be retained in the database files. If not specified, the freed file space is released to the operating system. TRUNCATEONLY Causes any unused space in the data files to be released to the operating system and shrinks the file to the last allocated extent, reducing the file size without moving any data. No attempt is made to relocate rows to unallocated pages. target_percent is ignored when TRUNCATEONLY is used. - Frank Please forgive me for being somewhat off topic. This information is going towards a db class written in php. Does MSSQL have an SQL command counterpart to mysql's Optimize or postgresql's Vacuum?? Thanks for any insight you may provide... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mssql_query ROLLBACK
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 Server 7 and I try to do this: $commit = FALSE; // SELECT @@TRANCOUNT returns 0 here = OK if(mssql_query(BEGIN TRANSACTION)) { // SELECT @@TRANCOUNT returns 1 here = OK if(mssql_query(INSERT INTO TABLE (DATE) VALUES ('$date'))) { // ... $commit = TRUE; } if($commit) { mssql_query(COMMIT TRANSACTION); return TRUE; } else { mssql_query(ROLLBACK TRANSACTION); return FALSE; } } else return FALSE; When INSERT is done without errors, everything is OK. But when it is not possible to insert data into a table for any reason, SQL server returns this error message: The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION. (severity 16) in ... .php But using SELECT @@TRANCOUNT I can check that TRANSACTION is started, I tried to name the transaction, it didn't help. I thought it is because I can't COMMIT/ROLLBACK empty transaction, but this works fine: mssql_query(BEGIN TRANSACTION); mssql_query(ROLLBACK TRANSACTION); What's wrong?!? Zmìò se díky novým, barevným èoèkám FreshLook! Nyní akèní nabídka. http://user.centrum.cz/redir.php?url=http://www.cibavision.cz -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP 4.3.0 + MSSQL database authenticationproblem?
Hi Alan, If this is a problem with PHP it's in the Sybase extension. I hvae not tried working with that since I made it possible to use --with-mssql (and I'm not the maintainer). Can you compile the cli version (--disable-cgi --with-mssql=path/to/freetds ...) and test a small comanndline script using the mssql_*() functions ? This should work with php 4.3.0, but I have made a few changes to the code in CVS and I can send you the latest files if you need them. This configuration is tested on sevral different Linux configurations and I use it every day so I know it works :-) - Frank 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 environment variable, no? Have you tried the tsql tool to see if you can connect ? Yes, and connected was made successfully. I used the name of the connection in 'freetds.conf'. I was able to confirm successful connection earlier by posting some logs to the FreeTDS list. I am starting to to think it is more and more a PHP issue. The only thing I haven't tried yet is downgrading the PHP version to that which is on the current server (4.1.2; an attempted upgrade to v4.2.3 just before Xmas resulted ina very similar problem) If you plan to use stored procedures I would make Not as far as I know. Right now, it is only used to pull information from tables. Alan __ Post your free ad now! http://personals.yahoo.ca -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP 4.3.0 + MSSQL database authenticationproblem?
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 bith the General and PHP-DB lists. First, a brief rundown of my setup: Mandrake Linux 9.0 Apache 1.3.27 PHP 4.3.0 We are in the process of rebuilding our outdated servers, and all sites have been moved over successfully, except our own, which has a Control Panel login. The login authentication is done using FreeTDS to an MSSQL 2000 database. This setup works fine on the current server, but when I test it on the new server, the authentication seems to work fine, but instead of the screen I normally see when logging in, I just get kicked back to the Control Panel login screen. At first, I suspected FreeTDS, but I have confirmed that a connection is definately being made by enabling and examining the dump file. The FreeTDS mailing list has confirmed that this is also the case. The current (working) server is running Apache 1.3.27 + PHP v4.1.2 . I had a similar problem on the current working server when I tried upgrading the PHP to v4.2.3 just before Xmas. I have not yet tried downgrading to v4.1.2 on the new server, and would rather not. :-) I am not really sure where to proceed from here. I can provide any further information you need, or can possibly provide a Test account if you wish to see for yourself what it is doing, which may give some ideas as to what is happening. Is there perhaps some logging variables I can enable in the Control Panel PHP script to see what is going on? Thank you, in advance, for your help and advice in this matter. Sincerely, Alan Murrell [EMAIL PROTECTED] __ Post your free ad now! http://personals.yahoo.ca -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] for xml auto from MS Sql Server
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 developed to access MS SQL and Sybase servers from (nix, and I have just tested 'for xml auto' from my Mandrake 9.0 box to a SQL Server 2000, and it seams to be working. - Frank Folks, I'd like to use Microsoft SQL Server 2000 XML capabilities for generating query results in XML. It is very easy, just say for xml auto at the end of your query. The problem is that I cannot seem to retrieve the results back into PHP. Anyone ever accomplish this? Daniel -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP 4.3.0 + MSSQL database authenticationproblem?
Hi Alan, Did you configure FreeTDS with the right tdsver ? This can be none when compiling FreetTDS using --with-tdsver=7.0 or in freetds.conf. You should use the correct version according to your MSSQL server (70. = SQL Server 7, 80 = SQL Server 2000). From PHP 4.3.0 you can compile php using --with-mssql=/path/to/freetds. FreeTDS needs to be compiled with --enable-msdblib, and you need to change your code (sybase_* should be mssql_*). The upside is access to all the mssql_* functions. I'm using this on a Mandrake 9.0 system and it works fine (FreeTDS 0.61) - Frank 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 version of FreeTDS are you using ? 0.60 on the new server; I am not sure about the currently working server, but I think it is 0.50 or 0.51. Do you use the sybase or the mssql extension in PHP The Sybase one ('sybase_connect'). The PHP was compiled with the '--with-sybase=/path/to/freetds' option. Thanx! Alan __ Post your free ad now! http://personals.yahoo.ca -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: undefined function: mssql_connect()
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). - Frank Do you have php_mssql.dll extension loaded? Check better with phpinfo(); Radovan [EMAIL PROTECTED] [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi there, Hope someone can help me with this. I need to connect to a MS SQL database but my attemps fail once and again. This is the error message I get when try to connect: Fatal error: Call to undefined function: mssql_connect() in /var/www/htdocs/DB_conn.php on line 8 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] undefined function: mssql_connect()
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 should not use ip:port as your host name. Port 1433 is the default for both MSSQL and FreeTds. If you use any other port number you should specify this in freetds.conf. - Frank Hi there, Hope someone can help me with this. I need to connect to a MS SQL database but my attemps fail once and again. This is the error message I get when try to connect: Fatal error: Call to undefined function: mssql_connect() in /var/www/htdocs/DB_conn.php on line 8 The script is very simple: ?php $hostname = 10.0.0.206:1433; $username = sa; $password = ; $dbName = dbname_here; $idLink = mssql_connect($hostname,$username,$password) or die(DATABASE FAILED TO RESPOND.); mssql_select_db($dbName) or die(Table unavailable); ? Now, this is the info I can provide: 1) PHP version 4.3.0-dev 2) phpinfo shows: './configure' '--prefix=/usr/local' '--enable-module=so' '--with-mod_charset' '--enable-sockets' '--enable-memory-limit' '--with-sybase=/usr/local/freetds' 3) Of course, freetds is located at /usr/local/freetds and works properly. It was tested using tsql -H -p -U and it's ok. 4) I also tried adding #!/usr/local/bin/php to try it as a shell scripting thing and it WORKS! Which is very confusing. 5) php.ini shows: [MSSQL] ; Allow or prevent persistent links. mssql.allow_persistent = On ; Maximum number of persistent links. -1 means no limit. mssql.max_persistent = -1 ; Maximum number of links (persistent+non persistent). -1 means no limit. mssql.max_links = -1 ; Minimum error severity to display. mssql.min_error_severity = 10 ; Minimum message severity to display. mssql.min_message_severity = 10 ; Compatability mode with old versions of PHP 3.0. mssql.compatability_mode = Off ; Valid range 0 - 2147483647. Default = 4096. ;mssql.textlimit = 4096 ; Valid range 0 - 2147483647. Default = 4096. ;mssql.textsize = 4096 ; Limits the number of records in each batch. 0 = all records in one batch. ;mssql.batchsize = 0 ; Use NT authentication when connecting to the server mssql.secure_connection = Off ; Specify max number of processes. Default = 25 ;mssql.max_procs = 25 I have no idea what the problem is; any help will be much appreciated. -Paula mail2web - Check your email from the web at http://mail2web.com/ . -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: php and db/c
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 to access the information via php. We have managed to make an odbc connection to the databases, and can successfully retrieve the field names, and field counts. However, php insists the tables are empty, returning -1 (empty set) for the odbc_num_rows(). When we make a raw odbc connection to run a direct sql query on the data, it all shows up fine. There is some miscommunication between odbc and php that is eluding us. Any input or suggestions would be welcomed. Thank you, Jay Merritt [EMAIL PROTECTED] Many odbc drivers do not return the correct value for odbc_num_rows. Have you tried odbc_result_all to see what comes back? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] how to call a stored procedure in SQLServer 2000
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 paramaters also Thanks a lot Thien -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] email form
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 the email. /* message */ $message = ' html head titleQuote Request/title /head body font size=4 face=Arial, Helvetica, sans-serif font color=#FF table width=105% border=0 cellspacing=3 cellpadding=2 tr td width=123 height=26font size=2 face=Arial, Helvetica, sans-serifCustomer: = $customer /font/td etc. I believe that I am not using the proper syntax for placing the customer field ($customer) The form still emails, but with no data in there, just he input as I have put it -Original Message- From: Ryan Holowaychuk [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 10, 2002 3:23 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] email form I am trying to figure out how to take the data that I have collected in a form and format it into another page basically a bunch of tables and graphics, and then email that form to a specific email address. I have been able to get it to collect, place into the page, but now how to email the complete form?? Does anybody have an idea??? Thanks Ryan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MSSQL Problems
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 written a script that works perfectly for almost ten times, and then stops being able to connect to the MSSQL server. I imagine this has something to do with me not properly closing my connection, and the server having a maximum # of connections. I'm calling both mssql_free_result() and mssql_close() after every query. I'm using mssql_pconnect. I would include sample code, but it does this whether I use code ripped right from examples and docs or I write it myself. It doesn't seem to matter what database, or the type or amount of information I'm requesting. Thanks for any help I get on this problem, it's driving me nuts. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] PHP and MS-SQL
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 versions of the C libraries but they have added a lot of new features to the server with version 6.5, 7.0 and 2000. These features are not available from the C libraries so no matter if you are using the native MSSQL extension for Win32 or you use the Sybase extension with FreeTDS you are limited to the features available in version 6.0 of MS SQL Server. These limitations include char and varchar columns with maximum 255 bytes. No support for nchar, nvarchar or ntext and other types as well. If you can design your tables without using the new features you should be able to make it work. One of the big differences in the SQL is support for views and subselects in MS SQL Server but stuff like LIMIT is not supported (though you can do a select top * ...). - Frank Thanks John! Say, are there any arguments not to use MS-SQL? Did you run into any problems? Thanks, Axel -Original Message- From: Negretti, John (CCI-San Diego) [mailto:John.Negretti;cox.com] Sent: Friday, October 25, 2002 3:14 PM To: Axel; [EMAIL PROTECTED] Subject: RE: [PHP-DB] PHP and MS-SQL Axel, Well, I'm not sure what everyone will tell you, but this is what I did. I used MyODBC (on windows) to connect to SQL Server using the built-in odbc_***() PHP functions. There is also the matter of changing your SQL Statements to be compatible with SQL Server. MySQL and SQL Server have quite a few differences with SQL Statements. As far as the rest of your code, it should not matter if it's on UNIX or Windows. John Negretti Web Applications Developer Cox Communications www.cox.com -Original Message- From: Axel [mailto:bergmann;hi.net] Sent: Friday, October 25, 2002 6:57 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] PHP and MS-SQL I want to apologize for my ignorance in advance... I'm developing PHP code with MySQL on Unix platforms for quite a while. Now I'm asked to use my unix based PHP code with a MS-SQL database on a Microsoft platform. So while having the php code on a unix platform the MS-SQL database is obviously sitting on a Microsoft platform. Can this work and if so how can I do this? Thanks, Axel __ Axel Bergmann ICQ#: 114599496 Current ICQ status: + More ways to contact me __ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Function that outputs at line xxx
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 have to pass __LINE__ and __FILE__ in your db_query() function, or whatever it is. ---John Holmes... - Original Message - From: Peter Beckman [EMAIL PROTECTED] To: 1LT John W. Holmes [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, October 23, 2002 3:26 PM Subject: Re: [PHP-DB] Function that outputs at line xxx John, that does work! Thanks. The problem is this: Database calls are in db.inc. The script problem occurs in wine.inc. True, the SQL is called and executed from db.inc, so __LINE__ and __FILE__ are correct in a way. But how do I find out where in the execution of my script the other files are in their execution? index.php -- calls function in wine.inc -- calls function in db.inc -- throws SQL error, calls function in wine.inc -- which prints error to user nicely and exits What I want is when db.inc throws the error and passes the error text to the db_error function in wine.inc to look pretty for the user, I want to know where the function db_query was called in wine.inc (one level up, the script which called the function now running). Is this possible? Does it exist? Peter On Wed, 23 Oct 2002, 1LT John W. Holmes wrote: __LINE__ and __FILE__ should work. ---John Holmes... - Original Message - From: Peter Beckman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, October 23, 2002 3:00 PM Subject: [PHP-DB] Function that outputs at line xxx Hey -- I'm writing a database error handler function in PHP, and I want it to tell me at what line in what script the error occurred. Is this possible? I know it happens when PHP hits a warning or a fatal error, but is it possible to do in a live script? Or is there a global variable which keeps track of what line in which scripts each execution is at? Thanks, Peter -- - Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ -- - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- - Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ -- - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RE: [PHP-DB] Text Field in SQL Server
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 fetched. - Frank BTW: 0 wasn't the right answer, but I get by with 10. :-) -Original Message- From: Ryan Jameson (USA) Sent: Wednesday, May 15, 2002 4:27 PM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Text Field in SQL Server I got it: In php.ini there is a setting for ODBC called odbc.defaultlrl, if you change it to 0 it will hand over everything. Ryan -Original Message- From: Ryan Jameson (USA) Sent: Wednesday, May 15, 2002 4:17 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Text Field in SQL Server When I make a field of Text type (MS SQL Server) and attempt to retrieve it from the database using PHP ODBC I don't get the whole thing. Anyone have any ideas? Thanks. Ryan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Maximum field length with PHP 4.1.2/MSSQL v7 ?
Hi, DB-Library from Microsoft has not been updated since SQL Server 6.x and Microsoft wants people to move to OLE DB so they have no plans on updating the (outdated) library. DB-Library is an old component fram Sybase. The only way to solve this is to use ADO through COM to communicate with the SQL Server, but this will not be available from a Linux/Unix box. - Frank Hi, I ran into the same problem, but the problem I have is that I can't switch to TEXT Datatype because MSSQL doesen't support SELECT DISTINCT or GROUP BY on them. The Workaround: SELECT CAST (fieldxyz AS TEXT) FROM tabelle abc is not useful because we build db-independent apps. I tried to recompile the MSSQL-Extension with MSSQL-Server 2000 with Service Pack 2 without success. I also changed the define DBMAXCHAR in the file Programme/Microsoft SQL Server/80/Tools/DevTools/Include/sqlfront.h to a higher value, but this does offcourse not affect precompiled libs from Microsoft. At the moment I have no idea how to solve this? :-( ... but in the Query-Analyzer is a setting where you can define 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 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 me when I needed it the most :-) The tool used to build the MSSQL extension for PHP (DB Library from Microsoft) was created for SQL Server 6.x and not updated with the release of 7.x or 2000. In version 6.x the max length of char and varchar columns was 255 bytes, and that is what you are seeing when you try to select data from char, nchar, varchar or nvarchar columns defined to be longar than 255 bytes. If you use the TEXT type you will not have this limitation. - Frank Hi All, I've come across an interesting problem. I'm trying to retrieve some text data (in this case a question up to 400 chars), but each time I perform a select statement I only receive the first 255 chars. What's the go here, is this just another microsoft thing ? -- Rgds, Chris MacKenzie Windows: Where do you want to go today ? Mac OS: Where do you want to be tomorrow ? Linux: Are you coming or what ? -- -- Michael Bretterklieber LCP JAWA Management Software GmbH Liebenauer Hauptstr. 200 A-8041 GRAZ Tel: ++43-(0)316-403274-12 Fax: ++43-(0)316-403274-10 GSM: ++43-(0)676-93 96 698 [EMAIL PROTECTED] homepage: http://www.jawa.at - privat --- E-mail: [EMAIL PROTECTED] homepage: http://www.inode.at/mbretter -- ...the number of UNIX installations has grown to 10, with more expected... - Dennis Ritchie and Ken Thompson, June 1972 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Connect to IBM DB2
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 --with-ibm-db2 and get the ODBC functions linked directly with CLI. This is not currently available on Windows. - Frank To connect to Microsoft SQL 7 I'm using the following script which works fine: ?php $query=SELECT * FROM DB1; $queryupd=UPDATE DB1 SET dateval='20010101' where dateval='2101'; $hostname = dbserver; $username = username; $password = pwd; $dbName = DB; mssql_connect($hostname,$username,$password) or die(DATABASE FAILED TO RESPOND.); mssql_select_db($dbName) or DIE(Table unavailable); $result2 = MSSQL_QUERY($queryupd); // Execute Update Statment $result = MSSQL_QUERY($query); // Execute Select Statment $number = MSSQL_NUM_ROWS($result); $i=0; if($number == 0) print No data?; elseif($number 0){ print Number of rows: $numberBR; while($i $number){ $dateval = mssql_result($result,$i,dateval); echo TRTDFONT color=#112266$dateval/FONT/TD; $i++;} } ? Now, how to connect to a DB2 database server without ODBC ? My config is: Web Server: IIS on windows 2000 Server Database Server: IBM DB2 V7.1 on windows 2000 Server PHP4 for windows Thanks. Jerry -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] MSSQL DB Connect
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 the tools. One of the toiols is called Client Network Utility. You can use this to specify aliases for your host names s[ your system knows the protocol to use. - Frank P.S You also need to enable the mssql extension ! I have PHP on windows 2000 web server I would like to remote to a MS SQL database on another web server. I tried something like: ?php $h = server adr; $u = user; $p = passw; $b = db; $connexion = mssql_connect($h, $u, $p); mssql_select_db($b); $sql = select * from test; $result = mssql_query($sql_temp); mssql_close($connexion); ? But it didn't work. Please help me. Jerry -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] How to install gdlibrary on windows 2000?
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. - Frank Hello, I am trying to install gdlibrary on windows. Unfortunatelly this seams to be too complicated. There are 3 components: zlib, pnglib and gdlibrary. All of them seam to need to be compiled. I did not find binarys for win 2000. Does anybody know a good description on how to install this on win 2k without a deep knowledge of c? Make does not work on windows, so I need a c compiler. This is deeper than I would like to go. Can it be that complicated to get this thing working? Thanx for any help cheers Andy -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: RE: [PHP-DB] Windows, MSSQL varchar255 caracters?
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 stuff. So the MSSQL extension does not use (slow) ODBC to communicate with the server, but jus a set of old libraries. - Frank The VARCHAR(255) bug is actually a limitation imposed by ODBC - so I suspect the MSSQL library uses ODBC for communication with a SQLServer installation. I've experienced the same problem using Java JDBC and some older SQL Server drivers. Recent type-4 MS SQL Server drivers for JDBC have fixed the problem, so no doubt subsequent ODBC implementations will contain the fix, such as that found in Windows XP. -- Jake [EMAIL PROTECTED] -Original Message- From: Ryan Marrs [mailto:[EMAIL PROTECTED]] Sent: Monday, November 12, 2001 5:15 AM To: 'Michael Schmidt'; '[EMAIL PROTECTED]' Subject: RE: [PHP-DB] Windows, MSSQL varchar255 caracters? I fixed this issue by using a text field instead of a varchar field. For some reason, it didn't want to read anything over 255 characters, although the data was still stored. Maybe it's a bug, or maybe just a limitation. Ryan -Original Message- From: Michael Schmidt [mailto:[EMAIL PROTECTED]] Sent: Monday, November 12, 2001 8:12 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Windows, MSSQL varchar255 caracters? Hi All. With the Microsoft SQL Server it is possible to make a table with fields of the type varchar which can have more then 255 characters width. When use a query to get the content, i only get the first 255 characters all others are cut off. (i connect to the DB via the mssql_... commands). Anyone has a idea how to solve the problem? Michael -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] counting categories
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 a different select for each one? or would you do something like select category from $table and then count all of the matches for each category perl php asp thanks much, Josh __ Do You Yahoo!? Make a great connection at Yahoo! Personals. http://personals.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] datetime in MSSQL7
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 fields are datetime. I have to use CLASS in php with querys inside the code that are independent on order of fields. setlocale? but what? regards Konrad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Driver for connecting SQL server
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 can be established. Then, my php script is as follow: $conn=odbc_connect(DNS=dnsname,userid,password); When I execute the script, I get the following error message: Warning: SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, SQL state IM002 in SQLConnect in c:\apache\intranet\default.php on line 6. How can I specify the missing driver? Should I install something? Thanks for your help. JL -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Installing SQL Server
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 extension. It works with version 6.x, 7.x and 2000 but it does not support all features of 7.0 and 2000. - Frank Has anybody succeeded in running PHP, using ODBC and the MS SQL Server ODBC driver? If so, I can use some guidance. Many thanks Todd -- Todd Cary Ariste Software [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Can't connect to MS SQL
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 mssql module is enabled. I am trying to connect to a database with the following code. ?php $hostname = 192.168.1.1:1433; $username = test; $password = smiley; $dbName = meyedev; $dbc = mssql_connect($hostname,$username,$password) or DIE(DATABASE FAILED TO RESPOND.); mssql_select_db($dbName) or DIE(Table unavailable); mssql_close($dbName); ? However I get the following error. Warning: MS SQL: Unable to connect to server: 192.168.1.1:1433 in c:\program files\apache group\apache\htdocs\meyedev\connect.php4 on line 11 DATABASE FAILED TO RESPOND. What am I doing wrong? Adam -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Re: A question about MSSQL! Help!!
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. This makes it difficult to create a native connection. - Frank You can try to modify the connect string because php's connect to database through TCP/TP. Tell me the result. Graycloud [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello, My php is running at RedHatLinux ,but now I want to connect to a MssqlServer2000 database on a Win2000 server. How could I do?? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] PHP4-ODBC-MSSQL7
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 SQL statement using PHP and the execute the statement. Using stored procedures binds your application tight to the DBMS. 2) If you are using NT as webserver you could use the native MSSQL functions. These functions are 4-5 times faster than ODBC. The only downside about the native functions are the lack of support for varchar, nvarchar columns larger than 256 bytes. This is a limmitation in the C-library provided by Microsoft. If you can use the Text type, this will not be a problem. - Frank Hello Everyone!! We are making on the project with PHP4 and MSSQL7. Everything is based on NT4 platform. Certainly, in this case we are operating by SQL stored procedures. The question is.. I found some problems while extracting data from database over ODBC which we need to use to make a bridge between PHP and MSSQL. For example, we created a table with columns: col_subj_id int col_subj_owner_id int col_subj_last_update timestamp(8) col_subj_title varchar(512) col_subj_content text(16) col_subj_keywords varchar(256) col_subj_secur int col_subj_reg_page varchar(128) Then I try to execute a stored procedure usp_get_subj: Create Procedure usp_get_subj ( @subj_id int ) As SELECT * FROM tbl_subject WHERE col_subj_id = @subj_id RETURN Well, everything is working in Query Analyzer and in ASP but not in PHP... If obviously to define the column names like: SELECT col_subj_id, col_subj_owner_id, col_subj_last_update, col_subj_title, col_subj_content, col_subj_keywords, col_subj_secur, col_subj_reg_page FROM tbl_subject WHERE col_subj_id = @subj_id it will not be working either... But! If to order the columns in the query of the stored procedure by data types like: SELECT col_subj_id, -- int col_subj_owner_id, -- int col_subj_secur, -- int col_subj_last_update, -- timestamp(8) col_subj_title, -- varchar(512) col_subj_reg_page, -- varchar(128) col_subj_keywords, -- varchar(2560 col_subj_content -- text(16) FROM tbl_subject WHERE col_subj_id = @subj_id everything will be working pretty good.. WHY? Do you have any ideas on this subject? ;-) Hope to obtain help from your side.. Thank you in advance. Mike P.S. The friend of mine who is ASP programmer just told me that there was such a problem with the old versions of ODBC. I am not sure but I am afraid that the PHP's ODBC support is aimed on that old ODBC driver. Could anyone advice me anything on this subject please? ?php include ('config.inc'); // script itself: $rs_gp = call_stored_procedure(usp_get_subj $QUERY_subj); while (fetch_row($rs_gp)) { $DB_home_text = get_field($rs_gp, col_subj_content); } $rs_gp = ; ? ?php // config.inc // database settings $DB_dsn = dsn_sundown; $DB_user = sundown; $DB_pass = ; include ('database.php'); ? ?php // database.inc // call the stored procedure function call_stored_procedure($query) { $conn = get_connection($GLOBALS[DB_dsn], $GLOBALS[DB_user], $GLOBALS[DB_pass]); $result = odbc_exec($conn, $query); return $result; odbc_close($conn); }; // get the connection handle function get_connection($dsn, $user, $pass) { $GLOBALS[conn] = odbc_connect($dsn, $user, $pass); return $GLOBALS[conn]; }; // retrieve the row of data function fetch_row($rs) { return odbc_fetch_row($rs); }; // retrieve the field of data function get_field($rs, $field) { if (!$rs) { $res = No data was returned..; } if ($rs) { $res = odbc_result($rs, $field); /* $no_r = odbc_num_rows($rs); $no_f = odbc_num_fields($rs); for ($i=1; $i=$no_f; $i++) { $fn = odbc_field_name ($rs, $i); if ($fn == $field) { $res = odbc_result($rs, $field); break; } } */ } return $res; }; ? Michael Yevdokimov Web developer e-mail: [EMAIL PROTECTED] Globalocity B.V. Tel.: +31 (0)70 312 2814 Fax.: +31 (0)70 312 2808
Re: [PHP-DB] testing ODBC + MSSQL connection locally
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 SQL server remotely? Will i simply need an IP Port and user/pass? If The MS SQL Server is configured to use TCP/IP you can use this to communicate with the server. If the Server uses named pipes you can uses this from a Windows box only. The MSSQL Server can be accessed using ODBC or the native mssql_* functions. You can enable the mssql functions by uncommenting ;extension=php_mssql.dll in php.ini. This requires that you are running on Windws and you install the client tools from MS SQL Server on yor PHP box. With ODBC and native MSSQL you can access remote or local databases. - Frank Thank you olinux -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] a simple question
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) { $array = explode ( , $input); $number = count ($array); if ($number 1) { return true; } else{ return false; } } if ($category) { $Query = SELECT * from $TableName WHERE ((category)=$category); } else { if ($title) { if (multi_word($title)) { print one word at a time for now; die(); } else { $Query = SELECT * from $TableName WHERE title LIKE '%$title%'; } } } when i try to pass in a multi-word string it doesnt print anything. I have tested the function and I know it works allright... if anyone could help that would be great. Brad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] PHP MSSQL, IIS Question -- Size Question
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 several nested tables and such in it. One of the fields to show is a blob field. If the blob field is too long, IIS will hang, and not be able to render the table. If the blob field is less than 2K it is fine. Sometimes it is bigger. If I remove the blob field from showing it always works fine, on every record. If I put the blob field in, it will hang on certain records but not all. How can I increase IIS's or PHP's buffer size so that it will render the entire page correctly everytime? Joshua -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] sybase function for MS-SQL Server
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) CREATE PROCEDURE SP3 AS insert into mytable values(...) insert into mytable values(...) Two results. The sybase extension is not written to handle multiple results in a single query. I have writteh the code for this in the MSSQL extension, but so far this extension is only available on Windows. - Frank -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] mssql_xxx() and characters
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 will need to restart the server for any changes to kick in. - Frank Hi! I have PHP4.05 and MSSQL7 desktop on Win2k. Problem occurs when I query results contain some extended characters, for example ä or similar. In place of these chars thaere are some non-aphanumeric ones displayed like boxes, etc.(,, instead of ä) or simply some alphabetic character. Mssql tables are fine and show these chars correcty. I tried to change the default charset of php (ISO series) but that didn't help. I use the mssql_xxx functions and not odbc. MySQL does not have such problems (I have tested it). Has anyone got a working mssql-php that does not have problems with some extended characters? Could I hope to fix it somehow, how? TIA Karl H. Peterson -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] MSSQL limit capability
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 wonderful features in MySQL on the limit, how could I do the same on MSSQL? The table I'm trying to retrieve is kinda big - like 500,000 records - and would like to read them in chunks. Thanks. Dreamvale -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]