Visualizzazione dei risultati da 1 a 6 su 6
  1. #1

    visualizzazione testo e foto

    Ciao!
    ho un problema.
    Creando un db con la seguente table

    create table news(
    idn1 int(11) NOT NULL auto_increment,
    titolo1 char(20) NOT NULL,
    mini1 char(20) NOT NULL,
    news1 char(20)NOT NULL,
    pub char(20)NOT NULL,
    foto blob NOT NULL,
    Type varchar(50)NOT NULL,
    primary key(idn1)
    )

    mandando in esecuzione il seguente file notizie.php

    <?php

    @mysql_connect("localhost", "root", "") or die("Connessione fallita !");
    @mysql_select_db("PORTALE") or die("Selezione Database fallita !");
    $query = "SELECT foto,news1, Type from news ";
    $select = @mysql_query($query) or die("Query fallita !");
    $result = @mysql_fetch_array($select);
    $notizia=$result["news1"];
    $data= $result["foto"];
    $type = $result["Type"];
    Header("Content-type: $type");
    echo $data;
    echo"
    ";
    echo $notizia;

    ?>

    stampa la foto ma non la notizia
    qualcuno mi può dire perchè?
    Ciao a tutti!

  2. #2
    beh dovresti generare una pagina con


    @mysql_connect("localhost", "root", "") or die("Connessione fallita !");
    @mysql_select_db("PORTALE") or die("Selezione Database fallita !");
    $query = "SELECT news1 from news ";
    $select = @mysql_query($query) or die("Query fallita !");
    $result = @mysql_fetch_array($select);
    $notizia=$result["news1"];
    echo "<img src=stampafoto.php>";
    echo"
    ";
    echo $notizia;



    e poi nel file stampafoto.php fargli stampare la foto..



    @mysql_connect("localhost", "root", "") or die("Connessione fallita !");
    @mysql_select_db("PORTALE") or die("Selezione Database fallita !");
    $query = "SELECT foto, Type from news ";
    $select = @mysql_query($query) or die("Query fallita !");
    $result = @mysql_fetch_array($select);
    $data= $result["foto"];
    $type = $result["Type"];
    Header("Content-type: $type");
    echo $data;

    cmq hai fatto 2 post uguali..
    visitate http://camicio.altervista.org per caxxate varie :d

  3. #3
    Funziona.
    Grazie tante sei stato veramente gentile.
    P.S
    Aggiornando, non mi ero accorto di avere generato lo stesso post

  4. #4
    ho cantato troppo presto

    Sto cercando da una home.php di aprire un link con il titolo di una news che mi rimanda ad una pagina con il testo della news e la sua foto.
    mi apre il link con il testo relativo ma la foto non compare.

    il record è: idn1 , (chiave) titolo1 , mini1 , news1 , pub , (mi serve per avere una condizione booleana),foto ,Type
    posto il codice fin ora compilato:

    create table news(
    idn1 int(11) NOT NULL auto_increment,
    titolo1 char(20) NOT NULL,
    mini1 char(20) NOT NULL,
    news1 char(20)NOT NULL,
    pub char(20)NOT NULL,
    foto blob NOT NULL,
    Type varchar(50)NOT NULL,
    primary key(idn1)
    )

    home.php
    <?php

    @mysql_connect("localhost", "root", "") or die("Connessione fallita !");
    @mysql_select_db("PORTALE") or die("Selezione Database fallita !");
    $sql="SELECT * from news where pub='1'";
    $select = @mysql_query($sql) or die("Query fallita !");

    while($riga=mysql_fetch_array($select)){

    $idn1=$riga["idn1"];
    $titolo1=$riga["titolo1"];
    $short=$riga["mini1"];

    echo"<table width=\"30%\" border=\"1\">";
    echo" <tr>";
    echo" <td>$titolo1</td>";
    echo" </tr>";
    echo" <tr>";
    echo"<td> <A HREF=\"notizie.php?idn1=$idn1\"> $short</td>\n";
    echo" </tr>";
    echo"</table>";
    }


    ?>
    notizie.php
    <?php

    $query = "SELECT foto,news1, Type from news where idn1='$idn1'";
    @mysql_connect("localhost", "root", "") or die("Connessione fallita !");
    @mysql_select_db("PORTALE") or die("Selezione Database fallita !");
    $query = "SELECT news1 from news where idn1='$idn1'";
    $select = @mysql_query($query) or die("Query fallita !");
    $result = @mysql_fetch_array($select);
    $notizia=$result["news1"];
    echo "<img src=stampafoto.php>";
    echo"
    ";
    echo $notizia;

    ?>
    stampafoto.php
    <?php

    @mysql_connect("localhost", "root", "") or die("Connessione fallita !");
    @mysql_select_db("PORTALE") or die("Selezione Database fallita !");
    $query = "SELECT foto, Type from news where idn1=''";
    $select = @mysql_query($query) or die("Query fallita !");
    $result = @mysql_fetch_array($select);
    $data= $result["foto"];
    $type = $result["Type"];
    Header("Content-type: $type");
    echo $data;

    ?>
    potete darmi una mano?

  5. #5
    beh anche stampafoto.php deve sapere l'id della foto da prendere... quindi..

    notizie.php
    <?php

    $query = "SELECT foto,news1, Type from news where idn1='$idn1'";
    @mysql_connect("localhost", "root", "") or die("Connessione fallita !");
    @mysql_select_db("PORTALE") or die("Selezione Database fallita !");
    $query = "SELECT news1 from news where idn1='$idn1'";
    $select = @mysql_query($query) or die("Query fallita !");
    $result = @mysql_fetch_array($select);
    $notizia=$result["news1"];
    echo "<img src=stampafoto.php?idn1=$idn1>";
    echo"
    ";
    echo $notizia;

    ?>


    e



    stampafoto.php
    <?php

    @mysql_connect("localhost", "root", "") or die("Connessione fallita !");
    @mysql_select_db("PORTALE") or die("Selezione Database fallita !");
    $query = "SELECT foto, Type from news where idn1='$idn1'";
    $select = @mysql_query($query) or die("Query fallita !");
    $result = @mysql_fetch_array($select);
    $data= $result["foto"];
    $type = $result["Type"];
    Header("Content-type: $type");
    echo $data;

    ?>
    visitate http://camicio.altervista.org per caxxate varie :d

  6. #6
    Funziona come un Orologio!
    veramente MILLE GRAZIE

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.