SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2003
    Location
    Domnican Republic.
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Display Images and info from mysql db with php

    Hi, i'm trying to make an upload process where users can upload pictures an put info. i have done the upload process but i'm having problems showing the info (image and other data) who do i display that?, i had read manuals online but they don't work .
    can someone helpe plz?

  2. #2
    SitePoint Wizard
    Join Date
    May 2003
    Location
    Berlin, Germany
    Posts
    1,829
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need to tell us your current code, which doesn't work for you.

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2003
    Location
    Domnican Republic.
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    here is where i upload the info.

    <HTML>
    <HEAD>
    <TITLE>Binario a BD</TITLE>
    </HEAD>
    <BODY>
    <?php
    if (isset($_GET['proceso'])){
    echo $_GET['proceso']."<br>";
    }
    ?>
    <FORM enctype="multipart/form-data" method="post" action="insertar.php">
    Name: <INPUT name="cname" type="text" id="cname4">
    Phone: <INPUT name="cphone" type="text" id="cphone4">
    E-mail: <INPUT name="cmail" type="text" id="cmail4">
    Location: <INPUT name="location" type="text" id="location4">
    Horse's Name: <INPUT name="hname" type="text" id="hname4">
    Horse's Age: <INPUT name="hage" type="text" id="hage4">
    Horse's Height: <INPUT name="height" type="text" id="height4">
    Sale/Lease/Give Away: <INPUT type="radio" name="my_rad" value="0" onclick="SetState(this, this.form.my_text)" checked>
    Give Away
    <INPUT type="radio" name="my_rad" value="1" onclick="SetState(this, this.form.my_text)">
    Lease
    <INPUT type="radio" name="my_rad" value="1" onclick="SetState(this, this.form.my_text)">
    Sale Price: <INPUT name="my_text" type="text">
    Horse's Breed: <select name="breed" id="select3">
    <option>Appaloosa</option>
    <option>Arabian</option>
    <option>Half-Arabian</option>
    <option>Anglo-Arabian</option>
    <option>Dutch Harness Horse</option>
    <option>Hackney</option>
    <option>National Show Horse</option>
    <option>Other</option>
    <option>Paint</option>
    <option>Pinto</option>
    <option>Quarter Horse</option>
    <option>Saddlebred</option>
    <option>Warmblood</option>
    <option>Welsh</option>
    </select>
    Headline: <INPUT name="headline" type="text" id="headline4" value="" maxlength="100">
    Description: <textarea name="description" cols="43" rows="8" wrap="PHYSICAL" id="textarea3"></textarea>
    Archivo: <INPUT type="file" name="archivo" size="30">
    <INPUT type="submit" name="submit" value="Subir archivo">
    </FORM>
    </BODY>
    </HTML>

    HEre is the listar_imagenes.php file

    <?php

    // Connecting to mysql databases

    @mysql_connect("localhost","root","") or die ("no se ha podido conectar a la BD");
    @mysql_select_db("final") or die ("no se ha podido seleccionar la BD");

    //Selecting an processing information from the table archivos

    $sql = "SELECT id, cname, cphone, cmail, hlocation, hname, hage, height, condition, price, hbreed, headline, description FROM hinfo";
    $consulta = mysql_query($sql) or die ("No se pudo ejecutar la consulta");

    //This while exist information in the table field
    While ($registro=mysql_fetch_assoc($consulta)){

    echo "<img src=\"ver.php?id=".$registro['id']."\">";


    }

    ?>

    here is the ver.php file
    <?php
    if (isset($_GET['id'])){
    $conexion = mysql_connect("localhost","root","powerplus") or die ("no se ha podido conectar a la BD.");
    mysql_select_db("final") or die ("No se ha podido seleccionar la BD");
    $sql = "SELECT archivo_binario, archivo_tipo FROM hinfo WHERE id = '".$_GET['id']."'";
    $consulta = mysql_query($sql,$conexion);
    $datos = mysql_result($consulta,0,"archivo_binario");
    $tipo = mysql_result($consulta,0,"archivo_tipo");
    header("Content-type: $tipo");
    echo $datos;
    }
    ?>

    what i want it's to rezise the pictures because that code runs good but if the picture is big (in pixels) it doesn't appear.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •