Jump to content

Not outputting image?


ash992

Recommended Posts

Everything is fine, I open it up, but you got a error message:

  Quote

The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must to be declared in the document or in the transfer protocol.

http://adspring.co.uk/engines/Ads-dis.php

 

Can you see the html structure ? 

<?php
include ("connect.php");
$query = "SELECT * FROM Users WHERE Type='AD'"; 
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
$ADI = $row['UID'];
echo '<a href="../adverts/' . $ADI . "/" . $ADI .'.php"><img src="../adverts/' . $ADI . '/' . $ADI . '.png"></a>';
?>

 

simplified it even more...

 

And I'm still getting no output, not sure why you're getting anything :s

When you open up your html source file do you see a properly html structure like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />	<title>
	CakePHP: the rapid development php framework:		Messages	</title>
<link href="/cakephp/favicon.ico" type="image/x-icon" rel="icon" /><link href="/cakephp/favicon.ico" type="image/x-icon" rel="shortcut icon" /><link rel="stylesheet" type="text/css" href="/cakephp/css/cake.generic.css" /><script type="text/javascript" src="/cakephp/js/jquery-1.4.3.min.js"></script>
<script type="text/javascript" src="/cakephp/js/form_validate.js"></script><script type="text/javascript">
//<![CDATA[
$(document).ready(function () {$("#submit-36739122").bind("click", function (event) {$.ajax({beforeSend:function (XMLHttpRequest) {$("div#sending").fadeIn();}, data:$("#submit-36739122").closest("form").serialize(), dataType:"html", success:function (data, textStatus) {$("div#sending").fadeOut();$("div#success").html(data);}, type:"post", url:"\/cakephp\/messages"});
return false;});});
//]]>
</script></head>
<body>
<div id="container">
	<div id="header">
		<h1><a href="http://cakephp.org">CakePHP: the rapid development php framework</a></h1>
	</div>
	<div id="content">


		<div id="success"></div>
<div id="sending" style="display: none">Sending.....</div>
<form action="/cakephp/messages" id="MessageIndexForm" method="post" accept-charset="utf-8"><div style="display:none;"><input type="hidden" name="_method" value="POST" /></div>
<fieldset>
    <legend>Ajax Request Form</legend>
    <div class="input text required"><label for="name">Name</label><input name="data[Message][name]" type="text" id="name" maxlength="30" /></div><div class="input text required"><label for="email">Email</label><input name="data[Message][email]" type="text" id="email" maxlength="30" /></div><div class="input textarea required"><label for="message">Message</label><textarea name="data[Message][message]" id="message" cols="30" rows="6" ></textarea></div><div class="submit"><input id="submit-36739122" type="submit" value="Send request" /></div></fieldset>
</form>
	</div>
	<div id="footer">
		<a href="http://www.cakephp.org/" target="_blank"><img src="/cakephp/img/cake.power.gif" alt="CakePHP: the rapid development php framework" border="0" /></a>		</div>
</div>
</body>
</html>

Sorry about not replying to this, It was a bit too late and my internet cut out, However I've just found something quite handy with the problem, the same link seems to display in all the other browsers I've tried, apart from chrome?

 

http://adspring.co.uk/engines/Ads-dis.php

 

Here's the source code again,

 

<?php
include ("connect.php");
$query = "SELECT * FROM Users WHERE Type='AD'";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
$ADI = $row['UID'];
echo '<a href="../adverts/' . $ADI . '/' . $ADI .'.php"><img src="../adverts/' . $ADI . '/' . $ADI . '.png" /></a>';
?>

I told you, why ? You still got an error message.

Your page does not have a proper html structure, something like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">
<htmlL>
   <head>
      <title>My first HTML document</title>
   </head>
   <body>
      <P>Hello world!
   </body>
</html>

Nope, I'm afraid not,

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">
<htmlL>
   <head>
      <title>My first HTML document</title>
   </head>
   <body>
      <?php
include ("connect.php");
$query = "SELECT * FROM Users WHERE Type='AD'";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
$ADI = $row['UID'];
echo '<a href="../adverts/' . $ADI . '/' . $ADI .'.php"><img src="../adverts/' . $ADI . '/' . $ADI . '.png" /></a>';
?>
   </body>
</html>

 

 

Still no chrome output

You probably use any php framework or CMS, right ?

If you do, you have to include a default.ctp page (or something else ) rendering a proper html structure and encoding.

Copy/paste this:

<?php include ("connect.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Test</title>
    </head>
<body>
<?php 

$query = "SELECT * FROM Users WHERE Type='AD'";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
$ADI = $row['UID'];
echo '<a href="../adverts/' . $ADI . '/' . $ADI .'.php"><img src="../adverts/' . $ADI . '/' . $ADI . '.png" /></a>';

?>     
</body>
</html>
           

 

 

Ignore "include('connect.php')" and try this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Test</title>
    </head>
<body>
<?php 
$connect = mysql_connect('server','username','password');
mysql_select_db('database_name',$connect);
$query = "SELECT * FROM Users WHERE Type='AD'";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
$ADI = $row['UID'];
echo '<a href="../adverts/' . $ADI . '/' . $ADI .'.php"><img src="../adverts/' . $ADI . '/' . $ADI . '.png" /></a>';

?>     
</body>
</html>

Nope still nothing.. I've found something very interesting though,

 

even if I remove all PHP... and just use

 

<img src="../adverts/1/1.png" />

 

Then it still doesn't echo an image... But when you view source it still links to the right place?

 

Not a clue what's happening..

I've found the problem... http://adspring.co.uk/engines/Ads-dis.php Is displaying for me now, The problem was because of the image size my google adblock was registering it as an advertisement, and making it not display... Totally forgot all about adblock.

 

Thanks for all of your help guys...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.