SQL is executed using PDO, causing the connection to be reset.

Source: Internet
Author: User
Connecting to a database with PDO is no problem:
$DSN = "Mysql:host=localhost;dbname=php_jquery_example"; try {$dbo = new PDO ($dsn, ' root ', ' 123 ');} catch (Exception $e) {D IE ($e->getmessage ());}


Preprocessing and binding are no problem:
$sth = $dbo->prepare (' SELECT event_id, Event_title, Event_desc from    events    WHERE event_id <? '); $sth->bindparam (1, $calories, PDO::P aram_int);


The problem is in the execution:
$sth->execute ();

the page dies directly, prompting the connection to be reset
The same problem can occur with direct execution:
foreach ($dbo->query (' SELECT * from Events ') as $row) {...



It is no problem to connect and query using the original method. This is the result of the PDO execution SQL statement, tangled for two days. please help me.


Reply to discussion (solution)

The following is the information printed out by the Aparch error log:
[ERROR] VirtualHost *:80--mixing * ports and non-* ports with a namevirtualhost address isn't supported, proceeding with UNDEFI Ned Results
PHP warning:php startup:unable to load Dynamic library '. \\.. \\php-5.2.14-Win32\\ext\\php_mssql.dll '-\xd5\xd2\xb2\xbb\xb5\xbd\xd6\xb8\xb6\xa8\xb5\xc4\xc4\xa3\xbf\xe9\xa1\ xa3\r\n in Unknown on line 0
PHP warning:php startup:unable to load Dynamic library '. \\.. \\php-5.2.14-Win32\\ext\\php_pdo_mssql.dll '-\xd5\xd2\xb2\xbb\xb5\xbd\xd6\xb8\xb6\xa8\xb5\xc4\xc4\xa3\xbf\xe9\ xa1\xa3\r\n in Unknown on line 0

Help analysis.

The advantage of using PDO is?????

PHP warning:php startup:unable to load Dynamic library '
Cannot load Dynamic library: Php_mssql.dll Php_pdo_mssql.dll

Is it because the lack of these two libraries affects the execution of the page.

PHP warning:php startup:unable to load Dynamic library '
Cannot load Dynamic library: Php_mssql.dll Php_pdo_mssql.dll

Is it because the lack of these two libraries affects the execution of the page.

It's not, not to mention SQL Server.

The advantage of using PDO is?????

General, replacement of the database system requires only the replacement of the DSN string
Of course, the SQL command also takes into account the differences

Did you solve the problem?

  • 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.