Showing Picture

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
NiGHTFiRE
Forum Contributor
Posts: 156
Joined: Sun May 14, 2006 10:36 am
Location: Sweden

Showing Picture

Post by NiGHTFiRE »

Hey all.
Here is my script:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>

<!-- Importerar Egenskaperna till sidan -->
<link href="page_properties.css" rel="stylesheet" type="text/css" />
</head>
<body>

<!-- Page Wrap -->
<table id="wrap" cellspacing="0">

	<!-- Contents Container -->
	<tr id="container">
		<td valign="top">
		
			<!-- Top -->
			<div id="top"><a href="http://www.auktionssiten.se"><img src="img/design/logo_34x226.jpg" alt="" width="226" height="34" /></a></div>
			<!-- /Top -->
			
			<!-- Horizontal Menu -->
			<div id="h_menu_bg">
			<ul id="h_menu">
				<li class="h_menu_active"><a href="index.php">hem</a></li>
				<li><a href="auctions.php">auktioner</a></li>
				<li><a href="fin_auctions.php">avslutade auktioner</a></li>
				<li><a href="contact.php">kontakt oss</a></li>
				<li id="last_menu_button"><a href="help.php">hjälp</a></li>
			</ul>
			</div>
			<!-- /Horizontal Menu -->
			
			<!-- Menu fade -->
			<div id="menu_fade"></div>
			<!-- /Menu fade -->
			
			<!-- Contents -->
			<!-- Left -->
			<div id="left">
				<h5>V&Auml;LKOMMEN TILL AUKTIONSSITEN.SE  </h5>
				<p>
					Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec molestie.Sed aliquam sem ut arcu. Phasellus sollicitudin. Vestibulum condimentum acilisis nulla. In hac habitasse platea dictumst. Nulla nonummy. Cras quis libero. Cras venenatis. Aliquam posuere lobortis. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec molestie.Sed aliquam sem ut arcu. Phasellus sollicitudin. Vestibulum condimentum acilisis nulla. In hac habitasse platea dictumst. Nulla nonummy. Cras quis libero. Cras venenatis. Aliquam posuere lobortis.
				</p>
			</div>
			<!-- /Left -->
			
			<div class="vhr"></div>
			
			<!-- Right -->
			<div id="right">
				<h5>DEN SENASTE UPPLAGDA AUKTIONEN</h5>
<?php
$sql = "SELECT COUNT(id) FROM auction where status='ny'";
$result = mysql_query($sql) or die(mysql_error());
//$limit = 3; // Antal "nya" nyheter
$row = mysql_fetch_array($result); 
$numrows = mysql_result($result, 0); // antal i databasen 
if (mysql_result ($result , 0) <= 0)
{
print '<br>Finns inga auction ännu!<br>';
}
else
{
$result = mysql_query("SELECT * FROM auction where status='ny' ORDER BY id DESC LIMIT 1");
$row = mysql_fetch_array($result);
$text = "Denna auktion startades: ". $row['datum_borja'];
$text .= "<br>";
$text .= "Auktionens namn är: ". $row['auktionnamn'];
$text .= "<br>";
$text .= "Det kan vara totallt ". $row['maxantalbud'];
$text .= " bud";
$text .= "<br>";
$text .= "Information om produkten: ". $row['info'];
print ($text);
}
?>
<?php
$var = "<p><a href=\"#\">";
$var .= "<img style=\"float: left;\" title=\"Produktnamn\"";
$var .= "src=\"img/products/\"". $row['bild'];
$var .= " border=\"0\" /></a>";
echo $var;
//echo "<p><a href=\"#\"><img style=\"float: left;\" title=\"Produktnamn\" src=\"img/products/\". $row['bild'] border=\"0\" /></a>";
echo "				<a href=\"#\"><img style=\"float: right;\" title=\"Lägg ett bud!\" src=\"img/design/startpage_img/bud_knapp_36x147.jpg\" width=\"147\" border=\"0\" /></a></p>";
?>
			</div>
			<!-- /Right -->
			
			<!-- Breake/Clear -->
			<br />
			<!-- /Breake/Clear -->
			<div class="hhr"></div>
			<!-- Both -->
			<div id="both">
				<h5>Så här går det till!</h5>
				<p>
					Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec molestie.Sed aliquam sem ut arcu. Phasellus sollicitudin. Vestibulum condimentum acilisis nulla. In hac habitasse platea dictumst. Nulla nonummy. Cras quis libero. Cras venenatis. Aliquam posuere lobortis. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec molestie.Sed aliquam sem ut arcu. Phasellus sollicitudin. Vestibulum condimentum acilisis nulla. In hac habitasse platea dictumst. Nulla nonummy. Cras quis libero. Cras venenatis. Aliquam posuere lobortis.
				</p>
			</div>
			<!-- /Both -->
			<!-- /Contents -->
		</td>
	</tr>

	<!-- /Contents Container -->	
	<tr>
		<!-- Footer -->
		<td id="footer">Copyright &copy; 2006 <a href="http://www.auktionssiten.se">Auktionssiten.se</a></td>
		<!-- /Footer -->
	</tr>
</table>
<!-- /Page Wrap -->

</body>
</html>
I'm trying to do so the picture will show up as well but it doesn't.
It's on line 84-87. The variable $var.
Please help me.
Thanks
User avatar
aerodromoi
Forum Contributor
Posts: 230
Joined: Sun May 07, 2006 5:21 am

Re: Showing Picture

Post by aerodromoi »

NiGHTFiRE wrote:Hey all.
Here is my script:

Code: Select all

$var = "<p><a href="#">";
$var .= "<img style="float: left;" title="Produktnamn"";
$var .= "src="img/products/"". $row['bild'];
$var .= " border="0" /></a>";
I'm trying to do so the picture will show up as well but it doesn't.
It's on line 84-87. The variable $var.
Please help me.
Thanks
As I don't know what's in $row['bild'] my answer won't be 100%.
Right now, your output certainly looks like this:

Code: Select all

<img style="float: left;" title="Produktnamn" src="img/products/"SOMETHING border="0" /></a>
So you might want to put the quotation mark at the end of the src string, not in the middle.

Code: Select all

$var .= "src="img/products/". $row['bild'].""";
aerodromoi
NiGHTFiRE
Forum Contributor
Posts: 156
Joined: Sun May 14, 2006 10:36 am
Location: Sweden

Post by NiGHTFiRE »

Thanks works now :)
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

...or slightly easier to read like this

Code: Select all

$var = '<p><a href="#">';
$var .= '<img style="float: left;" title="Produktnamn"';
$var .= 'src="img/products/"'. $row['bild'];
$var .= ' border="0" /></a>';
Post Reply