<?php
$servername = "someserver";
$username = "termodom_TMAL";
$password = "somepassword";
$dbname = "termodom_TDMajstor";
$conn = mysqli_connect($servername, $username, $password, $dbname);
if(!$conn)
{
die("connection failed: " . mysqli_connection_error());
}
$sql = "SELECT KORISNIKID, IME, SIFRA FROM KORISNIK";
$result = mysqli_query($conn, $sql);
if(mysql_num_rows($result) > 0)
{
while($row = mysqli_fetch_assoc($result))
{
echo "id: " . $row["KORISNIKID"] . "<br>";
}
}
else
{
echo "0 results";
}
?>
这是我所拥有的代码,由于某种原因它返回0 results
消息,但在我的表中却有行。
在phpMyAdmin
中,数据库名称为termodom_TDMajstor
,它的表KORISNIK
内有一行。
我在做什么错了?