Page 1 of 1
Unwanted double quotes in php file.
Posted: Mon Jun 20, 2011 1:48 pm
by nyo
Hi,
A quick question here. I am not sure if it is related to PHP though. I am working on a simple site and all my code (HTML, CSS, PHP) looks ok to me. However, somehow two empty spaces (about 20px) were added to the layout and I cannot get rid of them now. Here is the site I am talking about:
http://www.configureweb.com/ If you check it with Google Chrome, you will notice one empty space just above the site title, and another empty space just above the footer. When you use the "inspect element" feature of Chrome, you will see two double quotes causing this.
Any idea how to get rid of them?
Thanks,
Re: Unwanted double quotes in php file.
Posted: Mon Jun 20, 2011 2:31 pm
by jacek
I don't see the quotes you are talking about in the source, but you just need to delete them from the script.
Re: Unwanted double quotes in php file.
Posted: Mon Jun 20, 2011 2:40 pm
by nyo
jacek wrote:I don't see the quotes you are talking about in the source, but you just need to delete them from the script.
Jacek, they are not visible in the source and I checked my scripts (which are extremely simple) many times and couldn't find any problem. If you have Google Chrome, when you right click and select "Inspect element", you will see the double quotes.
Re: Unwanted double quotes in php file.
Posted: Mon Jun 20, 2011 2:45 pm
by bowersbros
try posting the source code?
Thanks

Re: Unwanted double quotes in php file.
Posted: Mon Jun 20, 2011 2:54 pm
by nyo
bowersbros wrote:try posting the source code?
Thanks

Good idea
index.php:
<?php include 'adm/inc/header.php'; ?>
<div id="main">
<?php
$result = mysqli_query($db, 'SELECT post_title, post_date, post_body FROM posts ORDER BY post_id DESC');
while ($row = mysqli_fetch_array($result)) {
$posts[] = array('title' => $row['post_title'], 'date' => $row['post_date'], 'body' => $row['post_body']);
}
foreach ($posts as $post):
echo '<h1>' . $post['title'] . '</h1>';
echo '<div id="postmeta">Posted by <strong>Nail</strong> on ' . $post['date'] . '</div>';
echo $post['body'];
endforeach;
?>
</div>
<?php include 'adm/inc/footer.php'; ?>
header.php:
<?php include 'adm/inc/db.php'; ?>
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml">
<link rel="stylesheet" type="text/css" href="style.css" />
<head>
<title>Configure WEB - Web Design, Development and other Internet Tips</title>
</head>
<body>
<div id="sitetitle">Configure WEB</div>
footer.php:
<div id="footer">
<p>© 2011 <a href="http://www.configureweb.com/">Configure WEB</a></p>
</div>
</body>
</html>
style.css:
body {
background:#ccc;
font-family:Verdana;
font-size:0.8em;
margin:auto;
width:800px;
}
#sitetitle {
margin:5px 0;
padding:5px 5px;
text-align:center;
background:white;
font-size:2.5em;
font-weight:bold;
}
h1 {
margin:0;
padding:5px 10px;
font-size:1.6em;
font-weight:bold;
}
h2 {
margin:0;
padding:5px 10px;
font-size:1.2em;
font-weight:bold;
}
p {
margin:0;
padding: 5px 10px;
font-family:Verdana;
}
#main {
padding:0 0 10px 0;
background:white;
}
#postmeta {
padding:0 0 0 10px;
font-size:0.9em;
}
.center {
text-align:center;
}
#footer {
margin:5px 0;
padding:5px 5px;
text-align:center;
background:white;
font-weight:bold;
}
.code {
padding:5px 10px 5px 30px;
background:#eee;
}
Re: Unwanted double quotes in php file.
Posted: Mon Jun 20, 2011 3:49 pm
by jacek
The page looks fine in chrome for me
Try making your html valid, that is the cause of most browser issues.
Re: Unwanted double quotes in php file.
Posted: Thu Nov 10, 2011 6:45 am
by eastbrony
Hi nailyener, I just fix mine by convert UTF-8 BOM to UTF - 8, hope this help