I have two files index.php and header.php
This is header.php
<?php
$host ="localhost";
$user ="hosting_user";
$db = "hosting_dbname";
$pass ="lamepassword";
$odb = new PDO("mysql:host=" . $host . ";dbname= . $db, $user, $pass);
?>
this is index.php
<?php require_once("header.php");?>
<html>
<head>
<title>Web Dev 1</title>
</head>
<body>
<form method="post" action">
Name: <input type="text" id="Box_num" name="Box_num" /><br />
Age: <input type="text" id="Names" name="Names" /><br />
<input type="submit" value="add" />
</form>
<?php
$query = "SELECT * FROM Owners";
$result =$odb->query($query);
if($result->)rowCount() > 0) {
foreach($result as $item){
echo($item['Box_num'] .<br />/n");
}
}
</body>
</html>
When I load index.php, all I get is a blank screen. When I use mysqli it works but doesnt load the sql query
/n"` as well – Don't Panic Jul 06 '15 at 20:06
/n");` a missing opening quote mark – OIS Jul 06 '15 at 20:08