Jump to content

jayjay1234

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Everything posted by jayjay1234

  1. here is my revisted code: <?php include("connect_db.inc"); $cxn = mysqli_connect($host,$user,$password,$dbname) or die ("couldn't connect to server"); /* Select shoes the type specified*/ $query = "SELECT * FROM products WHERE prod_type=\"{$_POST['interest']}\""; $result = mysqli_query($cxn,$query) or die ("Couldn't execute query."); /* Display results in a table */ echo "<table cellspacing='10' border='1' cellpadding='87' width='100%'>"; echo "<tr><td colspan='5' style='text-align: right'> Click on any picture to see a larger version. <hr /></td></tr>\n"; while($row = mysqli_fetch_assoc($result)) { $f_price = number_format($row['product_price'],2); /* check whether shoes comes in colors */ $query = "SELECT * FROM Colour WHERE product_name='{$row['product_name']}'"; $result2 = mysqli_query($cxn,$query) or die(mysqli_error($cxn)); $ncolors = mysqli_num_rows($result2); /* display row for each shoe */ echo "<tr>\n"; echo " <td>{$row['product_id']}</td>\n"; echo " <td style='font-weight: bold; font-size: 1.1em'>{$row['product_name']}</td>\n"; echo " <td>{$row['product_description']}</td>\n"; /* display picture if shoe does not come in colours */ if( $ncolors <= 1 ) { echo "<td><a href='/images/{$row['product_image']}' border='0'> <img src='/images/{$row['product_image']}' border='0' width='100' height='80' /> </a></td>\n"; } echo "<td align='center'>\$$product_price</td>\n </tr>\n"; /* display row for each colour */ if($ncolors > 1 ) { while($row2 = mysqli_fetch_assoc($result2)) { echo "<tr><td colspan=2> </td> <td>{$row2['product_colour']}</td> <td><a href='/images/{$row2['product_image']}' border='0'> <img src='/images/{$row2['product_image']}' border='0' width='100' height='80' /></a></td>\n"; } } echo "<tr><td colspan='5'><hr /></td></tr>\n"; } echo "</table>\n"; echo "<div style='text-align: center'> <a href='shoes_list.php'> <h3>Display more shoes</h3></a></div>"; ?> im not sure if the <a href..... link to my image is correct im not sure how to format it. my image directory is: C:\inetpub\wwwroot\shop\images
  2. Hi I am creating an e commerce website and I have been using a php dummies book to help me as I am a beginner. I am creating an e commerce website and I have created a page which consists of radio buttons where a user will be able to choose what type of shoe they would like to view. Once they have chosen the radio button and then clicked onto the show me button the type of shoe shown should be the same as the type they have chosen but no shoes are showing on the webpage. I am unsure if i have not entered the format correct in the image section of the database. Here is the code which i have created so far: /* Select shoes the type specified*/ $query = "SELECT * FROM products WHERE prod_type=\"{$_POST['interest']}\""; $result = mysqli_query($cxn,$query) or die ("Couldn't execute query."); /* Display results in a table */ echo "<table cellspacing='10' border='1' cellpadding='87' width='100%'>"; echo "<tr><td colspan='5' style='text-align: right'> Click on any picture to see a larger version. <hr /></td></tr>\n"; while($row = mysqli_fetch_assoc($result)) { $f_price = number_format($row['product_price'],2); /* display row for each shoe */ echo "<tr>\n"; echo " <td>{$row['product_id']}</td>\n"; echo " <td style='font-weight: bold; font-size: 1.1em'>{$row['product_name']}</td>\n"; echo " <td>{$row['product_description']}</td>\n"; echo "<tr><td colspan='5'><hr /></td></tr>\n"; } echo "</table>\n"; echo "<div style='text-align: center'> <a href='shoes_list.php'> <h3>See more shoes</h3></a></div>"; ?> in my database the product_image column the field just contains the file name e.g: heels.jpg. please can anyone help me to get the images displayed.. thank you
×
×
  • 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.