Jump to content

picture in databses


jamesyrawr

Recommended Posts

i seem to get this error in my code when i try to retrieve the location of the image stored

Parse error: parse error in C:\wamp\www\uniwork\guitars.php on line 48

 print "<td> <img src="products/guitars/'.$row['prod_image'].'" /></td>";

that piece of code doesnt seem to be working and i cant see why :(

can someone help fix me fix it please?

 

<!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>
<title>Flerp Guitars - Guitars</title>
<meta http-equiv="Content-Language" content="English" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="style/index.css" media="screen" />
</head>
<body>

<div id="wrap">

<div id="header">
<img src="images/logo.png" alt="Logo" height="150px" width="150px"/>
</div>

<div id="menu">
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="products.php">Products</a></li>
<li><a href="myaccount.php">My Account</a></li>
<li><a href="#">Accessability</a></li>

</ul>

</div>

<div id="content">
<div class="right"> 

<h2><a href="#">Guitars</a></h2>
<?php 
//To demonstrate the use of included files 
//We keep repeating the connection details. Lets put them in a separate file so we can re-use easily 
    include ("include/connect.php"); 

  // Create a query 
   $query = "SELECT * FROM products ORDER BY prod_id ASC"; 
  //Run the query on the table through the connection 
   $result = mysql_query ($query)  or die ("Error in query: $query. ".mysql_error());          
   //Display using tags this time 
   print "<table border = 12 >";           
   print " <tr><th>Product ID</th><th>Product Name</th><th>Product Price</th><th>Product Description</th><th>Product Colour</th></tr>";   
   while ($row = mysql_fetch_array($result))  
   {                                                                             
      print "  <tr>";
  print "<td> <img src="products/guitars/'.$row['prod_image'].'" /></td>";                                                          
      print "    <td>" . $row["prod_id"] . "</td>";                  
      print "    <td>" . $row["prod_name"]. "</td>";
  print "    <td>£" . $row["prod_price"] . "</td>";                  
      print "    <td>" . $row["prod_desc"]. "</td>";  
  print "    <td>" . $row["prod_colour"] . "</td>";                                      
      print "  </tr>";                                                         
   }                                                                             
   		print "</table>";      

?>
<p><strong> The links here are only for testing purposes, once the admin section is coded properly these will be stored in there and only accessible by the admin account.</strong></p> 
<a href="insertrow.php">Click Here to insert New details</a><br/>
<a href="deleterow.php">Click Here to delete details</a>
<a href="editrow.php">Click Here to amend the details</a>

<h2><a href="#">other ideas</a></h2>


<div class="footer">
<?php
$after = "Good afternoon! ";
$late = "Go To Bed! ";
$evening = "Good evening! ";
$morn = "Good morning  ";
$current_time = date('G');
if ($current_time >= 12 && $current_time <= 16) {
echo $after;
} 
elseif ($current_time >= 1 && $current_time <= 5) { 
echo $late;
}
elseif ($current_time >= 17 && $current_time <= 24) {
echo $evening;
}
elseif ($current_time >= 6 && $current_time <= 11) { 
echo $morn;
}
echo"<br/>";
echo"The current time is ";
echo(date("G"));
echo":";
echo(date("i"));
echo":"; 
echo(date("s"));
echo"  "; 
echo(date("A")); 
?>
</div>
</div>

<div class="left"> 

<h2>My Cart  :</h2>

</div>

</div>
<div style="clear: both;"> </div>


</div>

</body>
</html>


Link to comment
https://forums.phpfreaks.com/topic/217578-picture-in-databses/
Share on other sites

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.