dongying195959 2011-03-21 19:31
浏览 355

从可与include()一起使用的MySQL数据库中获取数据

I have a field in a MySQL database that contains a varchar. This varchar is intended to be a string that will be used to refer to a file location. For example, /file.php.

I've managed to grab this varchar and store it in a $locationarray using the code below:

$query4 = mysql_query("select filelocation from users where username='$username' limit 1");

while($rowloc = mysql_fetch_assoc($query4))
{
    $locationarray = $rowloc['filelocation'];   

}

However, when I use $locationarray in conjunction with the include() function, nothing is displayed on screen?

Is there a way to get data from a MySQL database that can be used with include()?

  • 写回答

1条回答 默认 最新

  • doumiang0597 2011-03-21 19:33
    关注

    The problem isn't with your include code, I suspect it's with the contents of filelocation.

    /file.php is an absolute path, so include will look for file.php in the root of your system.

    Files are included based on the file path given or, if none is given, the include_path specified. If the file isn't found in the include_path, include() will finally check in the calling script's own directory and the current working directory before failing. The include() construct will emit a warning if it cannot find a file; this is different behavior from require(), which will emit a fatal error.

    Source: http://uk3.php.net/manual/en/function.include.php

    Check your error log - if the file isn't found, the log will tell you exactly where include is looking.

    评论

报告相同问题?

悬赏问题

  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号