PHP页面在我的本地主机上加载,但在我的Web主机中未加载

时间:2019-04-21 21:12:11

标签: php mysql cpanel

我正在将网站上传到我的虚拟主机上,其中一个页面没有加载(为空白)。在我的本地主机服务器上,该页面每次都是由数据库中的每个id生成的。数据库连接和Web服务器上的设置正确,因为发布系统正在运行,每个提交都插入到我的数据库中。怎么了?

include 'https://site.ro/includes/config.php';
include 'https://site.ro/includes/connection.php';
if (!isset($_GET['anunt']) || empty($_GET['anunt']) || !is_numeric($_GET['anunt'])) {
                $errors[] = 'Error';
            } else {
                $anunt_id = $_GET['anunt'];

                $sql = 'SELECT * 
                        FROM date_anunt
                        WHERE anunt = ?';

                $statement = $connection->prepare($sql);
                $statement->bind_param('i', $anunt_id);
                $statement->execute();
                $result = $statement->get_result();
                $anunt = $result->fetch_all(MYSQLI_ASSOC);
                $result->close();
                $statement->close();
    if (!$anunt) {
            $errors[] = 'Acest anunt nu exista!';
        } else {
            $anunt = $anunt[0];

            $marca = $anunt['marca'];
            $model = $anunt['model'];
            $caroserie = $anunt['caroserie'];
            $an = $anunt['an'];
            $km = $anunt['km'];
            $stare = $anunt['stare'];
            $pret = $anunt['pret'];
            $descriere = $anunt['descriere'];

            $sql = 'SELECT * 
                    FROM imagini_anunt 
                    WHERE image_id = ?';

            $statement = $connection->prepare($sql);
            $statement->bind_param('i', $anunt_id);
            $statement->execute();
            $result = $statement->get_result();
            $images = $result->fetch_all(MYSQLI_ASSOC);
            $result->close();
            $statement->close();
            $connection->close();
        }
    }
    ?>

1 个答案:

答案 0 :(得分:0)

include 'https://site.ro/includes/config.php';
include 'https://site.ro/includes/connection.php';

include 旨在包括和评估指定的PHP文件。如果在本地获取它,则可以像PHP一样对其进行处理-如果通过完整的URL获取它,则将得到生成的HTML,这可能会导致错误。

尝试只包含/config.php,看看是否可行。