PHPprintf-php Tutorial

Source: Internet
Author: User
If you want to print the content of number & nbsp; of & nbsp; record & nbsp; in PHPprintf, it cannot be displayed on the page and no error message is displayed. & Nbsp; $ link & nbsp; new & nbsp; mysqli (& #39; localhost & #39;, & #39; PHP printf problems
If you want to print the content of number of record, it cannot be displayed on the page and there is no error message.
$ Link = new mysqli ('localhost', 'root', '', 'book ');

If (mysqli_connect_errno ())
{
Echo 'connection failed'. mysqli_connect_error ();
}

$ Query = "insert into detail values
('". $ Title."', '". $ author."', '". $ isbn."', '". $ price ."')";
$ Result = $ link-> query ($ query );
$ Num = $ link-> affected_rows;

If ($ result)
{
// Echo $ num. 'record inserted into database ';
// This line is displayed, but it cannot be displayed on the page //
Printf ("% c record stored in the database", $ num );
}

$ Link-> close ();
}
What is going on? Thank you.

------ Solution --------------------
C-the argument is treated as an integer, and presented as the character with that ASCII value.
D-the argument is treated as an integer, and presented as a (signed) decimal number.

Printf ("% d record stored in the database", $ num );

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.