0

When I run this I am getting no errors and no data back. What am I doing wrong?

Here is my code:

<?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 ?>
StaceyGirl
  • 6,826
  • 12
  • 33
  • 59

0 Answers0