我有这两个变量获取 SQL 长文本列 ( $results_text) 和另一个 ( $results_f2) 从用户获取信息:
那是我的新代码:
<?php
$results = mysqli_query($conn, "SELECT rc.text2, rl.* FROM table_config AS rc JOIN table_list AS rl ON rc.user = rl.user WHERE rl.email = 'user@gmail.com'");
while($row1 = mysqli_fetch_array($results))
{
$text2 = $row1[0];
$name = $row1[3];
$role = $row1[4];
$company = $row1[6];
echo $text2 .= str_replace(":name:", $name, $text2);
echo $text2 .= str_replace(":role:", $role, $text2);
echo $text2 .= str_replace(":company:", $company, $text2);
}
mysqli_close($conn);
?>
它正在工作,但给了我很多废话,比如一个带有名称的 text2,另一个带有角色,另一个带有公司,然后最后一个替换了所有变量/字符串。
哆啦的时光机