It is estimated that it is a punctuation problem. I can't find it. I want to help you.

Source: Internet
Author: User
It is estimated that it is a punctuation problem. I can't find it. I want to help you.
for($i=0;$i<$num;++$i){    $ming=$a1[$i];    $zjming=$a2[$i];    $zjtime=$a3[$i];    $mysqli->query('update xs set xinzhangjie='$zjming',zhangjieshijian='$zjtime' where xsMing='$ming'');     printf("Affected rows (UPDATE): %d ", $mysqli->affected_rows);    echo $ming.'---';


MYSQLI returns-1, indicating that the execution department is successful.
You can update a single-pick statement.
All variables can be recycled out of values. It is loop update, and it won't work. it is estimated that it is the punctuation of the update statement. I have tested many types of punctuation.
For example.

Xinzhangjie = '". $ zjming."' No
Xinzhangjie = '{$ zjming}' no
Xinzhangjie = "$ zjming" no
Xinzhangjie = ". $ zjming." No

..... My head is big.


Reply to discussion (solution)

$ Mysqli-> query ("update xs set xinzhangjie = '$ zjming', zhangjieshijian = '$ zjtime' where xsMing =' $ Ming '");

Double quotation marks

$ Mysqli-> query ("update xs set xinzhangjie = '$ zjming', zhangjieshijian = '$ zjtime' where xsMing =' $ Ming '");


Thank you so much, bro.

Double quotation marks

OK. Thank you for your help.

Use a hyphen to link strings and variables ..
The connection character is "."

Single quotes do not parse PHP variables...

So...

Single quotes do not parse PHP variables...

So...


Use a hyphen to link strings and variables ..
The connection character is "."

Therefore, double quotation marks are used. Now I understand. Thank you !~!~!~

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.