显示mysql表信息

时间:2013-12-06 20:46:03

标签: php mysql sql

我在显示MySQL表格中的信息时遇到了很多麻烦。 使用以下代码,我可以登录我的数据库。

以下是有关我的MySQL设置的一些信息: 我有一个名为ID的主要广告,设置为INT 我有两个名为DatoLedighed

的varchar

但我无法显示任何信息。这是代码:

<?php
    $con = mysql_connect ('all the db information (this works)');
    // Check connection
    if (mysqli_connect_errno())
    {
        echo "Failed to connect to MySQL: " . mysqli_connect_error();
    }

    $result = mysqli_query($con,"SELECT * FROM tider1");

    while($row = mysqli_fetch_array($result))
    {
       echo $row['Dato'] . " " . $row['Ledighed'];
       echo "<br>";
    }

    mysqli_close($con);
?>

1 个答案:

答案 0 :(得分:0)

您正在mysql_connect使用mysqli_query。那不行。他们都需要mysqli

$con = mysqli_connect ('all the db information (this works)');
相关问题