Mysql fetch array doesn’t show results

  Kiến thức lập trình

Hi all 🙂 I’m back to coding since 10 years and I’ve some issues with sql queries:

I create the connection, which is right

    $servername = "localhost";
    $username = "myuser";
    $password = "mypass";
    $db = "dbname"

    $conn = mysqli_connect($servername, $username, $password, $db);

Then the query:

    $page = basename($_SERVER['PHP_SELF']);

    $query = "select * from header_title where page_name = '".$page."'";
    $result = mysqli_query($conn,$query);
    $row = mysqli_fetch_array($result, MYSQLI_ASSOC);

if I try to echo

    <?= $row['title'] ?>

nothing is shown 🙁

What I’m doing wrong?

Showing a results of mysqli_fetch_array

New contributor

Marco Scarpa is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT