Unwanted double quotes in php file.

Ask about a PHP problem here.
Post Reply
nyo
Posts: 124
Joined: Mon May 09, 2011 1:55 pm
Location: Mobile

Unwanted double quotes in php file.

Post 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,
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Unwanted double quotes in php file.

Post 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.
Image
nyo
Posts: 124
Joined: Mon May 09, 2011 1:55 pm
Location: Mobile

Re: Unwanted double quotes in php file.

Post 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.
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: Unwanted double quotes in php file.

Post by bowersbros »

try posting the source code?

Thanks :)
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
nyo
Posts: 124
Joined: Mon May 09, 2011 1:55 pm
Location: Mobile

Re: Unwanted double quotes in php file.

Post 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;
}
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Unwanted double quotes in php file.

Post by jacek »

The page looks fine in chrome for me :?

Try making your html valid, that is the cause of most browser issues.
Image
eastbrony
Posts: 1
Joined: Thu Nov 10, 2011 6:35 am

Re: Unwanted double quotes in php file.

Post by eastbrony »

Hi nailyener, I just fix mine by convert UTF-8 BOM to UTF - 8, hope this help
Post Reply