Ekran SQL sorgusu sonuçları

0 Cevap php

Ben sorun bir SQL sorgusu sonuçları görüntüleniyor yaşıyorum. Bir ürünler tablosundan tüm görüntüleri ve fiyatlar görüntülemek için çalışıyorum.

Ben tarayıcıda "Sorgu çalışır" echo deyimi görüntülemek mümkün duyuyorum. Ancak, sonuç tarayıcıda görüntüleniyor değildir.

        if ($count > 0) {
            echo "Query works";
        } else {
            echo "Query doesn't work" ."<br/>";
        }

PHP Code:

$con = getConnection();
        $sqlQuery = "SELECT * from Products";

        // Execute Query -----------------------------           
        $result = mysqli_query($con, $sqlQuery);
            if(!$result) {
                echo "Cannot do query" . "<br/>";
                exit;
            }

            $row = mysqli_fetch_row($result);
            $count = $row[0];

            if ($count > 0) {
                echo "Query works";
            } else {
                echo "Query doesn't work" ."<br/>";
            }

          // Display Results -----------------------------

            $num_results = $result->numRows();

            for ($i=0; $i<$num_results; $i++) {
                $row = $result->fetchRow(MDB2_FETCH_ASSOC);
                echo '<img src="'.$row['Image'].'>';
                echo "<br/>" . "Price: " . stripslashes($row['Price']);

}

Screenshot 1
alt text Screenshot 2: removed the images from the database, and used a filepath instead

alt text Screenshot 3: print_r($row)

alt text

0 Cevap