Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3

Thread: php question

  1. #1
    Junior Member
    Join Date
    Nov 2005
    Posts
    4
    Member #
    11964
    what's the code to get this image from my database to show up on my website? Here's the code so far. The filename of the image is rulerOutfit.gif.

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

    <html>
    <head>
    <title>shopPhilly</title>
    <link rel="stylesheet" type="text/css" href="/include/stylesheet.css">
    <style type="text/css" media="all">@import "shopPhillyStyle.css";</style>
    <meta name="author" content="Lauren Pisciotta" />
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    </head>
    <body>

    <div id = "content">
    <h2> shopPhilly Style Guide</h2>



    echo "<h3> You chose to view an outfit for: $_POST[bodyType] body type!</h3>";

    $bodyType = @$_POST[bodyType] ;


    $sql = "SELECT `top` , `bottom` , `shoes` , `bag` , `accessory`, `picture` FROM `style guide` WHERE `bodyType` =

    '$_POST[bodyType]'";
    $result = mysql_query($sql,$conn) or die(mysql_error());

    while ($row = mysql_fetch_array($result)) {
    $top = $row['top'];
    $bottom = $row['bottom'];
    $shoes = $row['shoes'];
    $bag = $row['bag'];
    $accessory = $row['accessory'];
    $picture = $row['picture'];

    <td valign=middle align=center><img src=\"$picture\"></td>
    echo "<p> $top <br> $bottom <br> $shoes <br> $bag <br> $accessory <br> $picture </p>";


    }

    ?>

    </div>

    <h1><img src="shopPhilly.GIF" alt="shopPhilly" /></h1>

    <ul id = "links">
    <?php
    include("links.html");
    ?>
    </ul>

    <div id = "disclaimer">
    <?php
    include("footer.html");
    ?>
    </div>

    <body>
    </html>

  2.  

  3. #2
    Member shauno7's Avatar
    Join Date
    May 2004
    Posts
    82
    Member #
    6075
    Firstly, you might want to remove your password to the databases as it is still showing on your entry.

    Now, if your picture entry in your database is the file path, make sure you have the correct notation for a php function to correctly display a query (ie)try using this <img src='<?php echo $picture; ?>'>

    If your actual image file is stored in your database (from your post I am not quite sure whether it was the file path of the image file). Then to display your image for your database you will need to use the 'print' function (it works the same way as the echo function).

    Hope this helps.

  4. #3
    Senior Member hagen's Avatar
    Join Date
    Aug 2005
    Posts
    408
    Member #
    10882
    Liked
    1 times
    instead of instanticting a .jpg etc instantiate a php file as below in its place:



    Hope this helps -Hagen




    $db = $mysql_databasename;
    $link = mysql_connect($mysql_servername,$mysql_username,$m ysql_password);

    if (! $link) die("Couldn't connect to MySQL");
    mysql_select_db($db , $link) or die("Select Error: ".mysql_error());

    // Get a specific result from table
    $result = mysql_query("SELECT * FROM huts WHERE email_address='$email_address'") or die(mysql_error());

    // get the first (and hopefully only) entry from the result
    $row = mysql_fetch_array( $result ); // Print out the contents of each row into a table
    mysql_close($link);


    $photo_blog = $row['photo']; //extract entry photo from row...
    $photo_blog = imagecreatefromstring($photo_blog);


    header("Content-type: image/jpeg");
    imagejpeg($photo_blog);
    imagedestroy($photo_blog);
    Hagen Rose: hagen(at)jxwd(dot)co(dot)uk
    JX Web Development, Bournemouth, Dorset...JXWD.co.uk


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 09:13 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com