Why is no error message reported for phppdosql statement errors?

Source: Internet
Author: User
{Code ...} in the set part of the update statement, the error setishandle1andnewarticle_id5 {code...} is written ...} it should be setishandle1. After newarticle_id5 is executed, the data table will not be changed, but there is no error message, which makes me get it for a long time. I don't know how to return it...
$cdb=new \PDO('mysql:dbname=crawler;host=127.0.0.1;charset=utf8','root','*****');$cdb->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);$sql='update jb51_ps_article set is_handle=1 and new_article_id=5 where id=71665';$state=$cdb->exec($sql);print_r($cdb->errorInfo());

Here, the set part of the update statement has the error set isHandle = 1 and newArticle_id = 5

$sql='update jb51_ps_article set is_handle=1 and new_article_id=5 where id=71665';

Set isHandle = 1, newArticle_id = 5

After execution, the data table will not be changed, but there is no error message, which makes me get it for a long time. I don't know what's going on?

The output information is as follows:

Reply content:
$cdb=new \PDO('mysql:dbname=crawler;host=127.0.0.1;charset=utf8','root','*****');$cdb->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);$sql='update jb51_ps_article set is_handle=1 and new_article_id=5 where id=71665';$state=$cdb->exec($sql);print_r($cdb->errorInfo());

Here, the set part of the update statement has the error set isHandle = 1 and newArticle_id = 5

$sql='update jb51_ps_article set is_handle=1 and new_article_id=5 where id=71665';

Set isHandle = 1, newArticle_id = 5

After execution, the data table will not be changed, but there is no error message, which makes me get it for a long time. I don't know what's going on?

The output information is as follows:

Set the error mode when creating a PDO object

$cdb->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

Thentry/catchAn error can be captured.

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.