drwghu6386 2013-12-02 19:17
浏览 27

无法在此代码中找到错误,页面显示为空白

<?php
ini_set('display_errors', 'On');
error_reporting(E_ALL);
session_start();
if(!isset($_SESSION['user_id'])){
header('Location: login.php');
exit();
}
include('includes/db_connect.php');
$userid = $_SESSION['user_id'];
$sql = ("SELECT file_id FROM files WHERE user_id='$userid'");
$query = $db->query($sql);
if($query->num_rows ===1){
echo "<a href="index.php">Sorry you have already uploaded a file, to delete the current file and upload another please select retieve file from the homepage</a>";
}else{
echo "you can upload a file";
}
?>

The above checks to see if the user has uploaded a file. It does this by seeing if their is a file with their user id. some reason the page is just blank when loaded.

include just hold the connection string

been looking at this for ages, help would be appreciated, thank you in advance

  • 写回答

1条回答 默认 最新

  • dsbfbz75185 2013-12-02 19:19
    关注

    This line has a syntax error:

    echo "<a href="index.php">Sorry you have already uploaded a file, to delete the current file and upload another please select retieve file from the homepage</a>";

    If you define a string with double quotes ("), you must escape all double quotes contained in the string.

    Replace it with this:

    echo "<a href=\"index.php\">Sorry you have already uploaded a file, to delete the current file and upload another please select retieve file from the homepage</a>";

    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么