Database Related issues _php Tutorial

Source: Internet
Author: User
Tags dsn sql server driver sybase microsoft access database mysql odbc driver
Database related issues
This section discusses the most common issues between PHP and the database. In an exaggerated way, PHP can operate almost every database on the market today.
1. I heard that PHP can operate Microsoft SQL Server. What should I do?
2. Can I operate a Microsoft Access database?
3. I upgraded to PHP 4, and now my MySQL always tells me: "Warning:MySQL:Unable to save result set in ...". What's going on?
4. After installing the shared MySQL support, a libphp4.so Apache is dumps core. Can this problem be fixed?
5. Why do I always get this error message:: "warning:0 is not a MySQL result index in On line "or" warning:supplied argument is not a valid MySQL result resource in On line ?
1. I heard that PHP can operate Microsoft SQL Server. What should I do?
Under the Windows platform, you can just use the ODBC driver contained in the package.
Under the UNIX platform, you can use SYBASE-CT driver to manipulate Microsoft SQL Servers. Because their protocols (at least most of the products) are fully compatible. Sybase has a free version of Linux systems. For other UNIX systems, you may need to contact Sybase to get the correct library file. You can also refer to the answers to some of the questions below.
2. Can I operate a Microsoft Access database?
Yes. If you are running under Windows 9x/me, or nt/2000, you already have all the necessary tools. You can use ODBC and Microsoft ' s ODBC drivers for Microsoft Access databases.
If you are running PHP under UNIX and want to communicate with MS Access under Windows, then you need UNIX ODBC drivers. OpenLink Software provides a unix-based ODBC drivers. You can download a trial (non-expiring) pilot program, and the commercial version of the price is located in $675
Another option is to use SQL Server with Windows ODBC driver to store the data, and then you can use Microsoft Access (ODBC) and PHP (built-in SQL Server driver) to manipulate the library. Or use a different file format, access and PHP can be opened, such as operating system files or dBASE database. About this OpenLink software Tim Hayes wrote the following text: It is not a good idea to use another library as a middleware in a database where you can use PHP directly.
--for example with OpenLink ' s drive. If you do need a middleware library, OpenLink now publishes the Virtuoso (Virtual Database engine), which can run on NT, Linux, and other Unix platforms.
Please see website free download.


Another successful example is the use of MySQL (via MySQL ODBC) under Windows to synchronize the Access database. Steve Lawrence writes:

Follow the MySQL guidelines to install MySQL under your platform. The latest version can be obtained from http://www.mysql.com/(from your nearest mirror point!). In addition to setting up a MySQL database, do not need other special configuration, set up user account, you should set the user's host domain as "%", confirm your server name, database name, etc.
To find MySQL ODBC driver on MySQL site, the latest version should be Myodbc-2_50_19-win95.zip (NT). Install it under your Windows. You can use the tools in the toolkit to test if the installation is successful.
Create a DSN for the user and system in your ODBC administrator (Control Panel). Build a DSN name, enter your hostname, username (mysql), password, port number, and so on, the data you set in the first step.
To fully install access, this step allows you to install the necessary tool drivers: At a minimum, you need to manage connected database tables.
Now the most interesting thing has happened! Build a new Access database. Right-click on the "Link Tables" tab in the table, or under the "File" menu, select "Get External data" (Get External) and then "link Tables" (Link table). When the dialog box opens, select file type: ODBC. Select the DSN name that you created in the third step of the System DSN. Then select the table you want to link to. Press "OK", Oh! You can now open this table on your MySQL manager to add/edit/delete data! You can also build queries, input/output tables to MySQL, create forms and reports, etc.

Tips and Tricks:

You can create an Access table, output it to MySQL, or link it back. It will make it faster to create the table.
When you create a table in Access, you must set the primary key. Also, when you connect to access in MySQL, you have a primary key.
If you choose a table in MySQL, you have to relink in Access. Go >add-ins> link Table Manager

3. I upgraded to PHP 4, and now my MySQL always tells me: "Warning:MySQL:Unable to save result set in ...". What's going on?
Most of these problems are because the PHP 4 compilation option '--with-mysql ' does not indicate your MySQL path. PHP will then use its built-in MySQL library. If your system is running on a platform like this, PHP 3 acts as an Apache module, or Auth-mysql, and they use a different version of MySQL driver, so there is a conflict between two versions of the MySQL client driver.
recompiling PHP 4, adding MySQL path information, '--with-mysql=/your/path/to/mysql ' usually solves this problem.
4. After installing the shared MySQL support, a libphp4.so Apache is dumps core. Can this problem be fixed?
This happens if your MySQL is connected using pthreads. Please use LDD. If used, grab the MySQL tarball and recompile, or compile from source code rpm, remove the switch that opens the threaded client code in the relevant file. If neither of these methods can fix the error, recompile the new PHP library to support the new MySQL.
5. Why do I always get this error message:: "warning:0 is not a MySQL result index in on line" or "warning:supplied argument are not a valid My SQL result resource in?
The value of the result set variable you are using is 0. 0 means your query failed for some reason. Before you get the result set, you must check the reason for the failure of the commit query. The correct wording should be as follows: $result = mysql_query ("SELECT * from Tables_priv");
if (! $result) {
Echo Mysql_error ();
Exit
}

or $result = mysql_query ("SELECT * from Tables_priv")
Or Die ("Bad query:". Mysql_error ());

http://www.bkjia.com/PHPjc/314064.html www.bkjia.com true http://www.bkjia.com/PHPjc/314064.html techarticle database-related issues This section discusses the most common issues between PHP and the database. In an exaggerated way, PHP can operate almost every database on the market today. 1. I've heard that PHP can be manipulated ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.