Jump to content

Recommended Posts

Ok so ive been getting better and learning more thanks to help of everyone. So im using oscommerce as my shopping cart and ive been searching web on why csv file i uploaded the products pictures werent showing up. I looked around and i found a few answers but remember im still new to this i found this code

but where would i place it. Would this code work to show the images stored in my database? Thanks to anyone who can help.

 

<?php

 

// Connect to database

 

$errmsg = "";

if (! @mysql_connect("localhost","trainee","abc123")) {

        $errmsg = "Cannot connect to database";

        }

@mysql_select_db("wellho");

 

// Find out about images to display

 

$limit = 3;

 

if ($_REQUEST[iwant]) {

        $whereclause = "where title like \"%".

                $_REQUEST[iwant].

                "%\"";

        $gotten = @mysql_query("select * from pix $whereclause order by pid desc limit $limit");

        while ($row = @mysql_fetch_assoc($gotten)) {

                $imcolumn .= "<tr><td><img src=?gim=$row[pid] width=144><br>";

                $imcolumn .= htmlspecialchars($row[title])."</td></tr>";

                $nim++;

        }

        if (! $nim) $imcolumn = "<tr><td>No matching images</td></tr>";

} else {

        $imcolumn .= "<tr><td>Images will appear here</td></tr>";

}

 

// If this is the image request, send out the image

 

if ($_REQUEST[gim]) {

        $gotten = @mysql_query("select * from pix where pid = $_REQUEST[gim]");

        $row = mysql_fetch_assoc($gotten);

        $bytes = $row[imgdata];

        header("Content-type: image/jpeg");

        print $bytes;

        exit ();

        }

?>

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.