0

Why the following code gives blank output with no errors or Warnings?what to do to print the the words inside database "cheraman" start with letter 'alif'?

<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php
        $dbhost = 'localhost:3306';
        $dbuser = 'root';
        $dbpass = '';
        $conn = mysqli_connect($dbhost, $dbuser, $dbpass);
        mysqli_select_db($conn , "cheraman") or die(mysqli_error($conn));

        $data = mysqli_query($conn , "SELECT * FROM rootword_meaning") or die(mysqli_error($conn));
        $row = mysqli_fetch_assoc($data);
        $r=$row['ROOTWORD'];
        //echo $r;
        $w= str_split($r);
        define("n",mb_strlen($r));  

        $i=0;
        while($row == mysqli_fetch_assoc($data))
        {
        while($i<= n)
        {           
           if($w[n] == 'ا') //this if part is not working.the letter in single quote is arabic.
           {
             echo "No: ".$row['ID']."<br/>";
             echo "<a href=https://www.google.com>Word:".$row['ROOTWORD']."<br/></a>"; 
           }
           $i++;
        }
        }
        mysqli_close($conn);
        ?>
    </body>
</html>
Dharman
  • 30,962
  • 25
  • 85
  • 135

1 Answers1

0

Considering your DB connection is working fine.

Use print_r($row) and check if there is any output or error.

Please share the output

Case 1 - Data is present, then the column name may not matching with ROOTWORD.

Case 2 - Data is absent, then either table name is wrong.

Zeeshan Eqbal
  • 245
  • 2
  • 11