1

I uploaded csv file using phpmyadmin, and it is correctly uploaded and data is displayed correctly as showing in the following image.

Table Structure

enter image description here

Data in the Database

enter image description here

But on browser it is showing like this, means unreadable just ????? Showing on the page.

enter image description here

Here is how i am getting data using php

function get_quran_surat(){
        $query ="select suraid,suraname from quran group by suraid,suraname";
        $result=$this->query($query);
        $this->setcharset();
        $rows=array();
        while($row=$this->fetch_array($result)){
            $rows[]=$row;
        }
        return $rows;   
}

Also add the utf-8 in head section of the page.

enter image description here

Edited Table Structre

enter image description here

Question

How can i show readable data in the browsers ?

Hamza Zafeer
  • 2,360
  • 13
  • 30
  • 42
  • Your collation and HTML charset look good so it's probably your MySQL connection charset. See the **Data Access** section in [this answer](https://stackoverflow.com/a/279279/283366) – Phil May 05 '21 at 02:54
  • If that doesn't actually answer your question, let me know here in the comments – Phil May 05 '21 at 03:00
  • @Phil i changed charset to utf8mb4_general_ci but still wired characters are showing ? – Hamza Zafeer May 05 '21 at 03:07
  • Could you please [edit your question](https://stackoverflow.com/posts/67394550/edit) to include the relevant parts of your code? Show how you're setting the connection charset. Also show how you're displaying the data from `get_quran_surat()` – Phil May 05 '21 at 03:09
  • 1
    The connection charset needs to be made **before** you query. It's best done immediately after opening the connection. Also, `mysqli_set_charset()` takes **two** parameters – Phil May 05 '21 at 03:11
  • @Phil Adding the mysqli_set_charset showing the data correctly. Code edited in question – Hamza Zafeer May 05 '21 at 03:20

0 Answers0