2016-09-29 44 views
-2

我有一个查询,我从fetchrow.php上的MySQL数据库中获取行 我有一个config.php他们需要使用这些数据。我如何通过fetchrow解析它.php到config.php并返回?解析行MySQL查询在多个层

的config.php

$helloworld = "Hello ".$row['firstname']."" 

fetchrow.php(配置文件包含在PHP开始的)

$row = mysqli_fetch_array($query); 
echo $helloworld 
+2

你不能。当包含配置文件使其在配置文件中可用时,'$ row'必须已经存在。你需要重新思考你做事的方式,因为它听起来像是把输出放在你不应该做的地方。 – Styphon

回答

0

我希望这会帮助你。

定义在config.php

$helloworld = "Hello"; 

fetchrow.php

include('comfig.php'); 
$row = mysqli_fetch_array($query); 
echo $helloworld." ". $row['firstname']; 

谢谢