PHP won't work, how do I fix this? -
i'm new php , i'm trying understand seems not working. need add subscription option on website trying understand basics of php before did this, can show me have done wrong?
this php code:
<?php echo"<html>"; echo"<head>"; echo"<title>test home page</title>"; echo"</head>"; echo"<body>"; echo"<h1>test page</h1>"; echo"<p>test.</p>"; echo"</body>"; echo"</html>"; ?> <?php $host="localhost"; $user="root"; $password=""; $dbname="films"; $cxn=mysqli_connect($host,$user,$password,$dbname) or die("couldn't connect server"); $query="select * movie"; $result=mysqli_query($cxn,$query) or die("couldn't execute query"); if(!$result) { echo"error- " .mysqli_error($cxn); } if (mysqli_num_rows($result) > 0) { while($row = mysqli_fetch_assoc($result)) { echo "id - ".$row["filmid"]; echo " title - ".$row["title"]; echo " genre - " . $row["genre"]; echo " release year - ". $row["releaseyear"]; echo " director - ". $row["director"]; echo"</br>"; } } else { echo "0 results"; } mysqli_close($cxn); ?>
Comments
Post a Comment