我可以将信息插入表单中的其他字段,但联系人号码不会。数据库中有它的数据。当页面加载时,该字段只是空白。如果我从给出错误的行中删除 (array),我会收到 警告:implode():在第 27 行传递的参数无效,这是我在 php 文件下面评论的这一行。它正在工作并停止。不知道为什么。请帮忙。谢谢。
我想在其中显示联系人号码的表单输入
<p>
<input type="text" name="contactnumber" id="contactnumber" value="<?php echo
$string_contactnumber; ?>" readonly>
</p>
从 adminlogin 中选择联系人号码的查询,其中 adminlogin.profileid = coin.profileid
<?php
$con=mysqli_connect("localhost","root","password","administrator_logins");
session_start();
if($_SESSION['profileid'] != 'profileid') {
if (mysqli_connect_errno()){
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql = mysqli_query($con, "SELECT adminlogin.contactnumber FROM adminlogin INNER JOIN coin ON coin.contactnumber=adminlogin.contactnumber WHERE adminlogin.profileid=coin.profileid") or die(mysqli_error($con));
$contactnumber = mysqli_fetch_assoc($sql);
//this is the line of code that is giving the error
$string_contactnumber = implode(',', $contactnumber);
mysqli_close($con);
}
?>