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?