2016-07-13 11 views
-1

自分のコードで何が問題になっているようですか?ブートストラップを使用してデータベースからデータを表示する方法

これが私の 'transaction.php' ファイル

<?php 
include('include/config.php'); 

$query = mysql_query("select Id, Questions, Eaction, Presponsible, Accomplished, Partially, Cdate from tbJCI") or die (mysql_error()) 
?> 
<!DOCTYPE html> 
<html lang="en"> 
<head> 
<meta charset="utf-8"> 
<meta http-equiv="X-UA-Compatible" content="IE=edge"> 
<meta name="viewport" content="width=device-width, initial-scale=1"> 
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> 
<title>Tables</title> 

<!-- Bootstrap --> 
<link rel="stylesheet" type ="text/css" href="css/bootstrap.min.css" > 
<link rel="stylesheet" type="text/css" href="css/custom.css"> 

<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> 
<!-- WARNING: Respond.js doesn't work if you view the page via file:// --> 
<!--[if lt IE 9]> 
    <script src="https://cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css"></script> 
    <script src="https://cdn.datatables.net/select/1.2.0/css/select.dataTables.min.css"></script> 
<![endif]--> 
</head> 

<body> 
<div class="container-fluid"> 
    <div class="table-responsive"> 
     <table class="table"> 
      <tr> 
       <th>ID</th> 
       <th>Assesment Questions</th> 
       <th>Evidence of Action</th> 
       <th>Action Needed</th> 
       <th>Person Responsible</th> 
       <th>Accomplished</th> 
       <th>Partially</th> 
       <th>Completion Date</th> 
      </tr> 
      <?php 
       while($row=mysql_fetch_array($query)) 
       { 
        $Column1 = $row['Id']; 
        $Column2 = $row['Questions']; 
        $Column3 = $row['Eaction']; 
        $Column4 = $row['Presponsible']; 
        $Column5 = $row['Accomplished']; 
        $Column6 = $row['Partially']; 
        $Column7 = $row['Cdate']; 
      ?> 
       <tr> 
        <td><?php echo $Column1 ?></td> 
        <td><?php echo $Column2 ?></td> 
        <td><?php echo $Column3 ?></td> 
        <td><?php echo $Column4 ?></td> 
        <td><?php echo $Column5 ?></td> 
        <td><?php echo $Column6 ?></td> 
        <td><?php echo $Column7 ?></td> 
       </tr> 
      <?php 
        }//while 
      ?> 
     </table> 
    </div> 

</div> 
</body> 

であり、これは私のconfig.phpファイルである(注:私のconfig.phpファイルには、名前のフォルダ内にある)

<?php 
//$mysql_hostname = "localhost"; 
$mysql_user = "root"; 
$mysql_password = ""; 
$mysql_database = "dbiquomply"; 

$db = mysql_connect(localhost, $mysql_user, $mysql_password) or die ("Opps some thing went wrong"); 
mysql_select_db($mysql_database, $db) or die ("Opps some thing went wrong"); 
?> 

私はいつもこのメッセージを受け取っています。 致命的なエラー:7行目のC:\ xampp \ htdocs \ transactionjci \ include \ config.phpで未定義の関数mysql_connect()を呼び出す

+2

可能な重複引用されていません - このエラーはどういう意味をPHPで?](http://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php) –

+0

あなたのPHPのバージョンは何ですか? –

+0

PHP 7では 'mysql_ *'関数が削除されました。[使用を中止してください](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php)代わりに[PDO](http://wiki.hashphp.org/PDO_Tutorial_for_MySQL_Developers)を使用する必要があります。 –

答えて

0

この拡張機能はPHP 5.5.0では廃止され、PHP 7.0.0では削除されました。代わりに、MySQLiまたはPDO_MySQL拡張を使用する必要があります。あなたのエラーところで

uは< 5.5.0

エラーPHPを使用している場合: 'ローカルホストが' [参照の

$db = mysql_connect('localhost', $mysql_user, $mysql_password) or die ("Opps some thing went wrong"); 
関連する問題