Jump to content

Recommended Posts

i am in the process of creating an auction site.

However the images do not show , just the placeholder. Can anyone indicate where I have gone wrong ?

 

 

i am using this script to enter the items into the Database

html>
<head><title></title>    

<link rel="stylesheet" type="text/css" href="style.css">
         
</head>


<body>
<?php 
echo "<img src='auction_logo.png' id='logo'/>";
echo "<br>";
echo "<form class='add_item_form' action='check_item.php' method='POST'  enctype='multipart/form-data'>";

if(isset($_GET["item"]))
{

if($_GET["item"]=="duplicate")
{
    echo "<h4>Already entered this item</h4>";
    echo "<br>";
    echo "<h4>Please try again</h4>";
 
}

else if($_GET["item"]=="successful")
{
echo "<h4>Successfully added an item!</h4>";

}
 
else
{
echo "<h4>Please add an item</h4>";
}

echo "<label for='item_name' class='label'>Item Name:</label>";
echo "<input class='text'  type='text' name='item_name'/>";
echo "<br>";
echo "<label for='item_description'  class='label'>Item Description:</label>";
echo "<input class='text'  type='text' name='item_description'>";
echo "<br>";
echo "<label for='endtime'  class='label'> Ending Bid Time: </label>";
echo "<input  class='text'  type='text' name='endtime'>";
echo "<br>";
echo "<label for='item_pic'  class='label'>Item Picture: </label>";
echo "<input class='text'  type='file' value='item_pic' name='item_pic'>";
echo "<br>";
echo "<input class='submit' type='submit' value='Add Item'/>";

echo "</form>";
?>

</body>
</html>

 

This script displays the items

 

<html>
<head><title></title> 
 

 <link rel="stylesheet" type="text/css" href="style.css">
 
</head>

<body>
<?php 

session_start();

if(!isset($_SESSION["username"]))
{
    header("Location:login.php");
}

else
{

$DBHOST = "localhost";
$DBUSER = "root";
$DBPWD = "";
$DBNAME = "customs_auction";


$conn = new mysqli($DBHOST, $DBUSER, $DBPWD, $DBNAME);    
 if($conn->connect_error)
 {
 die("Connection failed!".$conn->connect_error);
 }
 
echo "<img src='auction_logo.png' id='logo'/>";
echo "<a href='logout.php' class='logout button'>Logout </a>";
 
    
$statement = "SELECT * FROM item";
$result = $conn->query($statement);

while($row = $result->fetch_assoc())
{

$iid = $row["item_id"];
$iname= $row["item_name"];
$ipic = $row["item_pic"];
$icurrentp = $row["current_bid"];
$iimg = "item/";
$iimg = $iimg.$row["item_pic"];
 
 
$link = "item_details.php?item_id=";
$item_details = $link.$iid;
echo "<div class='item'>";    
echo "<div class='item_row'>Item Id: $iid</div>";
echo "<div class='item_row'>Item Name: $iname</div>";
echo "<img class='item_img' src='$iimg' alt='image'>";
echo "<div class='item_row'>Current Bid: $$icurrentp</div>";
echo "<div class='item_row' ><a class='link' href='$item_details'>Item Details</a></div>";
echo "</div>";
 
}/*display all the items on screen*/

$conn->close();
}/*prevent direct access by user*/
 
 
?>    
    
    
</body>
</html>

 

 

Link to comment
https://forums.phpfreaks.com/topic/312094-photo-not-dislpaying/
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.