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 );