When you run the SQL statement using PDO, the connection is reset. it is okay to connect to the database using PDO:
$dsn = "mysql:host=localhost;dbname=php_jquery_example";try {$dbo = new PDO($dsn, 'root', '123');} catch(Exception $e) {die($e->getMessage());}
No problem with preprocessing and binding:
$sth = $dbo->prepare('SELECT event_id, event_title, event_desc FROM events WHERE event_id < ?');$sth->bindParam(1, $calories, PDO::PARAM_INT);
The problem is:
$sth->execute();
The page directly dies, prompting the connection to be reset
The same problem occurs during direct execution:
foreach ($dbo->query('select * from events') as $row) { ...
It is okay to connect and query using the original method. this is caused by the execution of SQL statements by PDO and has been entangled for two days. please help me .....
Reply to discussion (solution)
The following information is printed in the aparch error log:
[Error] VirtualHost *: 80 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined 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 the lack of these two databases affects page execution.
PHP Warning: PHP Startup: Unable to load dynamic library'
Cannot load dynamic library: php_mssql.dll php_pdo_mssql.dll
Is the lack of these two databases affects page execution.
Not to mention SQL Server.
The advantage of using pdo is ?????
For general purpose, you only need to replace the DSN string for changing the database system.
Of course, differences must be taken into account in SQL commands.
Is the problem solved?