douyuai8994 2016-01-15 13:10
浏览 13

我的PHP代码出了什么问题? 无法看到错误,因为它正在创建服务器错误

Working on some PHP, and keep encountering the Server error 500.

Here's my code, what am I doing wrong? I've tried a lot, but I have a feeling it's to do with line 17. I'm a novice coder, so I'm probably doing something simply wrong but any help is appreciated.

$category_id = '';
if( isset( $_GET['id'])) {
    $category_id = $_GET['id'];
}

for($i = 1; $i < sizeof($category_id); $i++);

include('dbconnect.php');
$title = "SELECT * FROM categories WHERE id = '$i'";
$stmt = $db->prepare($title);
$stmt->execute();
$result = $stmt->fetchAll();
$title = $result(1('name'));
include('base-template.php');
  • 写回答

1条回答 默认 最新

  • duandu8707 2016-01-15 13:17
    关注

    Errors

    1. Missing {} in for loop
    2. for loop never ends with ; at end
    3. Each and every time you are including dbconnect.
    4. $category_id should define as array
    5. $result(1('name')) is unclear. No idea what you expect too

    Check Fred-ii comment on your question

    评论

报告相同问题?

悬赏问题

  • ¥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 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?