php - 在 write() fpdf 中回显数据库
问题描述
$con = mysqli_connect("localhost","root","","final_osa");
$sel_query="SELECT * FROM ched_scholars WHERE id = '".$_GET['id']."';";
$result = mysqli_query($con,$sel_query);
while($row = mysqli_fetch_assoc($result)) {
$pdf->Write( 6, 'I, echo $row["student_name"];, of legal age and a resident of echo $row["present_address"]; understand that an Educational Scholarship/Financial Grants-in Aid has been awarded to me so that I may enroll in and complete the echo $row["course"];.' );
}
如何在 write() 中回显学生姓名?谢谢
解决方案
尝试在您的字符串中使用“{$var}”:
例如:
$myVar = "student";
$myString = "The {$myVar} are good.";
在你的情况下:
$con = mysqli_connect("localhost","root","","final_osa");
$sel_query="SELECT * FROM ched_scholars WHERE id = '".$_GET['id']."';";
$result = mysqli_query($con,$sel_query);
while($row = mysqli_fetch_assoc($result)) {
$pdf->Write( 6, 'I, {$row["student_name"]}, of legal age and a resident of {$row["present_address"]} understand that an Educational Scholarship/Financial Grants-in Aid has been awarded to me so that I may enroll in and complete the {$row["course"]}.' );
}
推荐阅读
- node.js - 如何为 Web 应用程序执行特定于设备的身份验证?
- tkinter - 为什么 fielddialog 小部件在退出时会重新启动 Spyder 内核?
- vagrant - 在 SLS 文件中使用 create_self_signed_cert
- powerbi - Power BI - 具有两种不同数据类型的列
- terraform - Terraform 我得到 count.index 总是 0
- json - 使用 powershell 的 Zscaler API Json 问题
- python - 分组方式适用于多列?
- three.js - Three.js:如何使用相机旋转值在轴上旋转球体
- python - 如何从具有多个值的 groupby 对象中获取最大值?
- angular - 角 | 不同项目之间的共享模块