选择两个表并显示输出

时间:2014-03-09 04:44:47

标签: php mysqli

大家好我有问题 我想输出两个表并将其显示在我的表单中 但问题是当我输出第二个表时出现错误..

这是我的第一张桌子,它运作正常。

 $id = $_GET['id'];
$tjbvqry = $mysqli->prepare("SELECT `id`,`jobcode`,`cdate`,`start`,`end`,`group`,`projecttitle`,`location`,`dealer` FROM table_joborder WHERE id = ?");
$tjbvqry->bind_param('i', $id);
$tjbvqry->execute();
$tjbvqry->bind_result($id,$jcode,$cdate,$start,$end,$group,$projecttitle,$location,$dealer);

if(!$tjbvqry->fetch()){

  throw new Exception("Error Processing Request". $id , 404);

}

//Fetching all data from database//
while ($row = $tjbvqry->fetch()){

  $id           = $row['id'];
  $jcode        = $row['jobcode'];
  $cdate        = $row['cdate'];
  $start        = $row['start'];
  $end          = $row['end'];
  $group        = $row['group'];
  $projecttitle = $row['projecttitle'];
  $location     = $row['location'];
  $dealer       = $row['dealer'];
}

但是当我选择第二个表并输出它们时 我有错误

致命错误:未捕获的异常'异常',消息'错误处理请求18'

这是我的第二张表

    $id = $_GET['id'];
$tjcqry = $mysqli->prepare("SELECT 
                                   requisition,
                                   status,
                                   estimatedstart,
                                   estimatedcomplete,
                                   timestarted,
                                   timeend,
                                   contractor,
                                   details,
                                   description,
                                   completed,
                                   verified,
                                   leader,
                                   members FROM table_jobordercompleted WHERE id = ?");
$tjcqry->bind_param('i', $id);
$tjcqry->execute();
$tjcqry->bind_result($requisition,$status,$estart,$ecomplete,$tstarted,
                         $timeend,$contractor,$details,$description,$completed,$verified,$leader,$member);
if(!$tjcqry->fetch()){

  throw new Exception("Error Processing Request" . $id  , 404);

}

while ($row  = $tjcqry->fetch()){


  $requisition    = $row['requisition'];
  $status         = $row['status'];
  $estart         = $row['estimatedstart'];
  $ecomplete      = $row['estimatedcomplete'];
  $tstarted       = $row['timestarted'];
  $timeend        = $row['timeend'];
  $contractor     = $row['contractor'];
  $details        = $row['details'];
  $description    = $row['description'];
  $completed      = $row['completed'];
  $verified       = $row['verified'];
  $leader         = $row['leader'];
  $member         = $row['members'];


}

提前致谢 我希望你能帮助我..

0 个答案:

没有答案