Jump to content

KBBach

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Everything posted by KBBach

  1. So now it's working ^^ Thanks you both so much for your help!!!! Just to summerize : Products.php <head> <title>Med-Tech.dk<title> <link rel="stylesheet" href="css/style.css" type="text/css"> </head> <body> <html> <table class="main"> <tr> <td class="banner" height="120px"> <div id="banner"> </div> </td> </tr> <tr> <td> <div id="links"> <a href="index.php">Home</a> | <a href="products.php">Products</a> | <a href="contact.php">Contact</a> </div> </td> </tr> <tr> <td> <div id="bodytext"> <?php $con = mysql_connect("localhost","reader","reader"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("medtech", $con); $result = mysql_query("SELECT * FROM products"); while($row = mysql_fetch_array($result)) { echo '<table class="products">'; echo '<tr>'; echo '<td colspan=2 class="leftrightborder">'; echo '<h1>'; echo $row['Name']; echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td width=200 class="leftborder">'; ##echo 'billede her'; echo '<IMG width=200 src=getProdImg.php?id=' . $row['ID'] . '>'; echo '</td>'; echo '<td class="rightborder">'; echo $row['SDesc']; echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td colspan=2 class="leftrightborder">'; echo '<h3>'; echo $row['ArticleNR'] ; echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td colspan=2 class="leftrightbotborder">'; echo $row['Desc']; echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td class="leftrightborder" colspan=2>'; echo '&nbsp'; echo '</td>'; echo '</tr>'; echo '</table>'; } mysql_close($con); ?> </div> </td> </tr> </table> </html> </body> getProgImg.php: <?php ##error_reporting(E_ALL) $con = mysql_connect("localhost","reader","reader"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("medtech", $con); if(isset($_GET['id'])) { $id=$_GET['id']; $res = mysql_query("select PIC from products where ID=" . $id); $img = mysql_fetch_array($res); header('Content-Type: image/jpeg'); echo $img[0]; } ?> This is for a school project, so I really wanna credit your guys! You can send me some info on whom to credit on a pm
  2. Hum well... I can see the logic.. But I'm working on the getProdImage and can't get it working... getting following error: Parse error: parse error in C:\wamp\www\MedTech\getProdImg.php on line 3 Well here's my code: <?php error_reporting(E_ALL) $con = mysql_connect("localhost","reader","reader"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("medtech", $con); if(isset($_GET['id'])) { $id=$_GET['id']; $img = mysql_query("select PIC from products where ID="+$id); echo $img; } ?> Anyway.. .The Databse ID is simply called ID and the largeblob with the image is called PIC...
  3. Sooo.... what I need to do is to make a page that does nothing but getting the image from the sequel server and then link to that page? Errhmm how do I carry over the ID (unique identifier) from the products.php to the getProdImg.php to get the right image?
  4. Hi! I'm trying to store images in the largeblob format on my sql server (wamp-server) and then displaying them on a PHP site, but pretty much nomatter what I try it seems that php vomits.. I've tried different image (jpg/jpeg) files but I think phpmyadmin screws them up or something.. Anyway... here's the code: <head> <title>Med-Tech.dk<title> <link rel="stylesheet" href="css/style.css" type="text/css"> </head> <body> <html> <table class="main"> <tr> <td class="banner" height="120px"> <div id="banner"> </div> </td> </tr> <tr> <td> <div id="links"> <a href="index.php">Home</a> | <a href="products.php">Products</a> | <a href="contact.php">Contact</a> </div> </td> </tr> <tr> <td> <div id="bodytext"> <?php $con = mysql_connect("localhost","reader","reader"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("medtech", $con); $result = mysql_query("SELECT * FROM products"); while($row = mysql_fetch_array($result)) { echo '<table class="products">'; echo '<tr>'; echo '<td colspan=2>'; echo '<h1>'; echo $row['Name']; echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td width=200>'; #echo 'billede her'; header('Content-Type: image/jpeg'); echo $row['PIC']; echo '</td>'; echo '<td>'; echo $row['SDesc']; echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td colspan=2>'; echo '<h3>'; echo $row['ArticleNR'] ; echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td colspan=2>'; echo $row['Desc']; echo '</td>'; echo '</tr>'; echo '</table>'; } mysql_close($con); ?> </div> </td> </tr> </table> </html> </body> Any wise words would be appreciated - I've been working on this all day and my sanity is balancing on the edge of a knife...
×
×
  • 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.