尝试查看我的数据库时出错

时间:2016-04-07 09:58:27

标签: php mysql

这是我遇到的错误:

  

致命错误:未捕获错误:在C:\ xampp \ htdocs \ SLR \ dbconnect.php中调用未定义函数mysql_connect():2堆栈跟踪:#0   C:\ xampp \ htdocs \ SLR \ ViewData.php(2):include()#1 {main}抛出   第2行的C:\ xampp \ htdocs \ SLR \ dbconnect.php

这是我的代码:

<?php
include("dbconnect.php");

$con = mysql_connect("localhost","root","");

if (!$con)
{
     die('Could not connect: ' . mysql_error());
}
$db=mysql_select_db("slr", $con);
$result = mysql_query("SELECT * FROM software");
echo "<table border='1'>
<tr>
<th>Software ID</th>
<th>Software Name</th>
<th>Installed Date</th>
<th>Expiry Date</th>
<th>Product Key</th>
</tr>";
while($row = mysql_fetch_array($result))
{
    echo "<tr>";
    echo "<td>" . $row['soft_id'] . "</td>";
    echo "<td>" . $row['soft_name'] . "</td>";
    echo "<td>" . $row['installed_date'] . "</td>";
    echo "<td>" . $row['expiry_date'] . "</td>";
    echo "<td>" . $row['product_key'] . "</td>";
    echo "</tr>";
}

0 个答案:

没有答案