PHP printf 的有关问题
程序员文章站
2022-03-23 21:15:56
...
PHP printf 的问题
想把number of record 的内容print出来,可是在页面上无法显示,无错误提示信息。
$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 ';
//就是这一行想显示出来,可是无法在页面上显示//
printf( "%c record stored in the database ",$num);
}
$link-> close();
}
请教到底怎么回事?谢谢
------解决方案--------------------
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);
想把number of record 的内容print出来,可是在页面上无法显示,无错误提示信息。
$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 ';
//就是这一行想显示出来,可是无法在页面上显示//
printf( "%c record stored in the database ",$num);
}
$link-> close();
}
请教到底怎么回事?谢谢
------解决方案--------------------
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);
相关文章
相关视频
上一篇: webstorm不识别react怎么办