isiah Posted May 14, 2009 Share Posted May 14, 2009 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 (); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/158186-help-with-displaying-image-links-stored-in-mysql/ Share on other sites More sharing options...
BK87 Posted May 17, 2009 Share Posted May 17, 2009 is this code oscommerce specific? or just random code? Quote Link to comment https://forums.phpfreaks.com/topic/158186-help-with-displaying-image-links-stored-in-mysql/#findComment-835651 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.