当我运行此操作时,我没有收到任何错误,也没有数据。我做错了什么?
这是我的代码:
<?php
include 'connnectionmsql.php';
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
//Query
$sql = $conn->prepare("SELECT carid, carname FROM Cars WHERE carid = '1578'");
$sql->execute() ;
?>
<div id="contents">
<header>
<div id="top">
<div class="h2">
<?php while( $row = $sql->fetch()) : ?>
<h1><span><?php echo $row['carname']; ?></span>
<?php endwhile ?>