Jump to content

[SOLVED] Help with some code


joshgarrod

Recommended Posts

Hi,

I am adding the url of an image to a database an then displaying the data in a table, i want the url to display as a link to the image, how do i go about making this happen?

 

<!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=iso-8859-1" />
<title>View spares stock</title>
<style type="text/css">
<!--
#Layer1 {
position:absolute;
left:14px;
top:63px;
width:196px;
height:22px;
z-index:1;
}
.style1 {font-family: Arial, Helvetica, sans-serif}
.style2 {font-family: Arial, Helvetica, sans-serif; color: #FFFFFF; }
.style3 {color: #0000FF}
#Layer2 {
position:absolute;
left:378px;
top:63px;
width:87px;
height:21px;
z-index:2;
}
.style4 {color: #0000FF; font-family: Arial, Helvetica, sans-serif; }
-->
</style>
</head>

<body>
<div class="style1" id="Layer1"><a href="index.php?page=Search1" class="style3">Click here to search stock </a></div>
<TABLE WIDTH="100%" HEIGHT="40" BORDER="0" CELLPADDING="10" CELLSPACING="5" BGCOLOR="#FFFFFF">
<TR bgcolor="#F0F0F0">


<TD width="8%" HEIGHT="40" ALIGN=bottom class="style1" ID="header"><strong><em><FONT SIZE="1" COLOR="#8A8A8A">ID number </FONT></em></strong></TD>
<TD width="10%" ALIGN=middle class="style1" ID="header"><strong><em><FONT COLOR="#8A8A8A" SIZE="1">Stock number </FONT></em></strong></TD>
<TD width="48%" ALIGN=middle class="style1" ID="header"><strong><em><FONT COLOR="#8A8A8A" SIZE="1">Stock description </FONT></em></strong></TD>
<TD width="22%" ALIGN=middle class="style1" ID="header"><strong><em><FONT COLOR="#8A8A8A" SIZE="1">Image </FONT></em></strong></TD>
<TD width="12%" ALIGN=middle class="style1" ID="header"><strong><em><FONT COLOR="#8A8A8A" SIZE="1">Item price inc. VAT </FONT></em></strong></TD>
</TR>

<TR> 
<TD HEIGHT="40" ALIGN=middle class="style2" ID="header"> </TD>
<TD ALIGN=middle class="style2" ID="header"> </TD>
<TD ALIGN=middle class="style2" ID="header"> </TD>
<TD ALIGN=middle class="style2" ID="header"> </TD>
<TD ALIGN=middle class="style2" ID="header"> </TD>
</TR>

<?php
$con = mysql_connect("localhost","sgsdg","gsdgdsg");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("ssdsfdg", $con);


   $query = "SELECT * FROM `stock`";
        $result = mysql_query($query);

$num=mysql_num_rows($result);
$i=0;


while ($i < $num) {
$a=mysql_result($result,$i,"ID");
$b=mysql_result($result,$i,"StockNumber");
$c=mysql_result($result,$i,"StockDescription");
$e=mysql_result($result,$i,"Image");
$d=mysql_result($result,$i,"ItemPrice");



print ($i % 2) ? "<tr bgcolor=\"ffffff\">" : "<tr bgcolor=\"fff000\">";

print "<td align=center>$a</td>";
print "<td align=center>$b</td>";
print "<td align=center>$c</td>";
print "<td align=center>$e</td>";
print "<td align=center>$d</td>";

++$i;
}
?>
</table>
</body>
</html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.