Ishaan Chauhan
Ishaan Chauhan

Reputation: 9

The Connection is Successful but nogetting the data into website mysql

We are Trying to Connect php & mysql we got connection successful but we are not receiving the data any ideas please guide

Also we are using mysql and php

The Connection is Successful but nogetting the data into website

enter code here`Please let me know who to correct it<html>
<head>
<title> Welcome to PDM</title>
</head>
<body>
<div>
<centre>
Good For Checking The Prices
</centre>
<?php>` 


    $db_host = "localhost";
    $db_username = "wikiacwj_price";
    $db_pass = "";
    $db_name = "wikiacwj_price";

    mysql_connect("$db_host","$db_username","$db_pass") or die ("Please Try Again");
    mysql_select_db("wikiacwj_price") or die ("no data");

    $sql = mysql_query("SELECT * FROM price_comparsion where product_name='ok'");

    //write the results

    while ($row = mysql_fetch_array($sql)); {
    echo $row['product_name'];}

    ?>
    </body>
    </html>

Upvotes: 1

Views: 67

Answers (1)

DocJones
DocJones

Reputation: 677

The Semicolon immediately after your while statement telling the while loop to do ... nothing :)

...
while ($row = mysql_fetch_array($sql)) {
  echo $row['product_name'];
}
...

shoud do the trick.

Upvotes: 2

Related Questions