0

I am trying to make an application in which I use the simple while loop in PHP file to show the record. the code in product.php is here: How to use this in javascript. I need to call the in the java file in the same way.

    $sql2 = "SELECT * FROM product";
        $result2 = $DBcon->query($sql2);

            if ($result2->num_rows > 0) {
                // output data of each row
                while($row2 = $result2->fetch_assoc()) {
                    $pname = $row2["product_name"];
                    $timg = $row2["thumb_img"];
                    $pimg = $row2["product_img"];

                    if(!empty($timg)){
                      echo '<img src="adminpanel/upload/product/'.$timg.'" alt="'.$pname.'" title="'.$pname.'">';
                    }else{
                      echo '<img src="adminpanel/upload/product/'.$pimg.'" alt="'.$pname.'" title="'.$pname.'">';
                    }                           
                }
            }
Ali
  • 11
  • 1
  • 1
  • 2
  • try using ajax? – Rotimi Jan 21 '18 at 17:20
  • 1
    Possible duplicate of [What is the difference between client-side and server-side programming?](https://stackoverflow.com/questions/13840429/what-is-the-difference-between-client-side-and-server-side-programming) – Rotimi Jan 21 '18 at 17:23

1 Answers1

0

If you need to call something in javascript from php in the same file you could do something like this

var h=<?php $h ?>;