Database-related issues

Source: Internet
Author: User
Tags odbc mysql mysql client php and sybase valid microsoft access database mysql database
Data | database | Problem database related issues
This section discusses the most common problems between PHP and the database. In exaggeration, PHP can almost operate all the databases that are available on the market today.
1. I've 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 the installation of shared MySQL support, a loaded libphp4.so Apache on the dumps core. Can you fix this problem?
5. Why do I always get this error message:: ' warning:0 is not a MySQL result index in <file> ' line <x> ' or ' warning:supplied Argu ment is isn't a valid MySQL result resource in <file> on line <x>?
1. I've heard that PHP can operate Microsoft SQL Server. What should I do?
Under the Windows platform, you can just use the ODBC driver included in the package.
Under the UNIX platform, you can use SYBASE-CT driver to manipulate Microsoft SQL Servers. Because their protocols (at least the vast majority of products) are fully compatible. Sybase has a free Linux systems version. For other Unix systems, you might want to contact Sybase to get the correct library files. 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 (not expired) pilot program, the commercial version of the price positioning in $675
Another option is to use Windows ODBC-driven SQL Server to store data, and then you can use Microsoft Access (ODBC) and PHP (built-in SQL Server-driven) to manipulate the library. Or use a different file format, Access and PHP can open, such as operating system files or dBASE databases. About this OpenLink Software's Tim Hayes wrote the following: It's not a good idea to use another library as a middleware if you can use PHP to manipulate a database directly.
-for example, with OpenLink ' s drive. If you really need a middleware library, OpenLink now publishes the Virtuoso (Virtual database engine) that can run on NT, Linux, and other Unix platforms.
Please refer to website for free download.


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

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, no other special configuration, set user account, you should put the user's host domain set to "%", confirm your server name, database name, etc.
In the MySQL site up and down to find MySQL ODBC driver, the latest version should be Myodbc-2_50_19-win95.zip (NT). Install it under your Windows. You can test the success of the installation with the tools in the toolkit.
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.
Fully install access, this step allows you to install the necessary tool drivers. At least you need to manage the database tables for the connection.
Now the most interesting thing has happened! Build a new Access database. Right-click in the table, select Link Tables, or under the File menu, select Get External data and then link tables (linked table). When the dialog box is open, select the file type: ODBC. Select the System DSN, the name of the DSN you created in step three. 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 create queries, input/output tables to MySQL, create forms and reports, and so on.

Tips and Tricks:

You can create an Access table, output it to MySQL, or link it back. It will make creating tables faster.
When you create a table in Access, you must set a primary key. Similarly, when you connect to access in MySQL, you also have a primary key.
If you choose a table in MySQL, you will have to relink in Access. Go to >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 due to PHP 4 compiler option '--with-mysql ' without indicating your MySQL path. PHP will use its built-in MySQL library. If your system is running on such a platform, PHP 3 as the Apache module, or auth-mysql, they use a different version of MySQL driver, so there will be conflicts on two different versions of the MySQL client driver.
recompiling PHP 4, adding MySQL path information, '--with-mysql=/your/path/to/mysql ' usually solves the problem.
4. After the installation of shared MySQL support, a loaded libphp4.so Apache on the dumps core. Can you fix this problem?
This can happen if your MySQL is connected by pthreads. Please use LDD. If used, grab the MySQL tarball and recompile, or compile from source rpm, remove the switch that opens the threaded client code in the relevant file. If neither of these methods fixes this error, recompile the new PHP library to support the new MySQL.
5. Why do I always get this error message:: "Warning:0 is isn't a MySQL result index in ' line ' or ' warning:supplied argument is isn't a valid my SQL result resource in?
The result set variable you are using is a value of 0. 0 means that your query failed for some reason. Before you get the result set, you must check why the Submit query failed. The correct wording should read 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 ());



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.