0

I want to link MySQL DB to the HTML and get the data according to the query below.

SELECT * FROM feature1 WHERE place = 'feature2'

php seems one of the way to do this, since I am one day old with php don't have much knowledge. I wrote the code below, but when run it gives me an error with no solid output. Is the code correct?

I want to query the DB using the above query and display data!!

<?php
$db = mysqli_connect('localhost','user','password','DB_name')
or die('Error connecting to MySQL server.');

> $query = "SELECT * FROM feature1";


mysqli_query($db, $query) or die('Error querying database..');
$result = mysqli_query($db, $query);
$row = mysqli_fetch_array($result);
while ($rows = mysql_fetch_array($query)) { 
   $name = $rows['Name'];
   $address = $rows['Address'];
   $email = $rows['Email']

   echo "$name<br>$address<br>$email<br>$subject<br>$comment<br><br>";  
?>

fig

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.