1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Problem could not show the image

Discussion in 'PHP' started by t6werserv, Jan 24, 2010.

  1. #1
    Problem could not show the image from a database
    
    
    $sql = "SELECT content FROM upload WHERE id=$id";
    if(!($result=mysql_query($sql))) showerror;
    $data=mysql_fetch_array($result);
    echo'<img border=0 src='.$data['content'].' width=248 height=166>';
    
    
    
    Code (markup):

     
    t6werserv, Jan 24, 2010 IP
  2. hasanbasri

    hasanbasri Peon

    Messages:
    78
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    $sql = "SELECT content FROM upload WHERE id=$id";
    $result=mysql_query($sql);
    $data=mysql_fetch_array($result);
    if($data) 
    echo'<img border=0 src='.$data['content'].' width=248 height=166>';
    else
    showerror();
    
    Code (markup):
     
    hasanbasri, Jan 24, 2010 IP
  3. RDJLabs

    RDJLabs Peon

    Messages:
    170
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You have a single quote problem in syntax use following code


    
    $sql = "SELECT content FROM upload WHERE id=$id";
    if(!($result=mysql_query($sql))) showerror;
    $data=mysql_fetch_array($result);
    echo "<img border=0 src=".$data['content']." width=248 height=166>";
    
    PHP:
     
    RDJLabs, Jan 24, 2010 IP
  4. t6werserv

    t6werserv Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    result:


    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\AppServ\www\myscripts\uploads\view.php on line 15

    Fatal error: Call to undefined function showerror() in D:\AppServ\www\myscripts\uploads\view.php on line 19
     
    t6werserv, Jan 24, 2010 IP
  5. t6werserv

    t6werserv Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    
    
    
    $sql = "SELECT content FROM upload WHERE id=$id";
    if(!($result=mysql_query($sql))) showerror;
    $data=mysql_query($result);
    echo "<img border=0 src=".$data['content']." width=248 height=166>";
    
    
    
    Code (markup):
    not error but no view picture!
     
    t6werserv, Jan 24, 2010 IP
  6. ibg

    ibg Member

    Messages:
    25
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    38
    #6
    
    $sql = "SELECT content FROM upload WHERE id=$id";
    if(!($result=mysql_query($sql))) showerror;
    $data=mysql_fetch_assoc($result);
    echo '<img border="0" src="'.$data['content'].'" width="248" height="166">';
    
    PHP:
     
    ibg, Jan 24, 2010 IP
  7. t6werserv

    t6werserv Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    print data no image

    «¾ئئئزززتتت–¢¯\m}ٌٍِؤؤؤ„™©¨ش‎PMJٌîéذذذ“’’êىîx½‏¯¯¯¢££ججج Z…؛e~•o¬î‎ُْSSS™±عi§îنمâûّْ‚‚‚£»م¢،ں¤¤¤»»»KJJ*¸هزذد×ظعFNXكغضصصصOe{861ôٌٍëëيçههGEB؟هے?²ےجےكٍےïùےمممًًًىىىهههںےàààO¹ےدىےيييêêê¥ےâââëëëççç™ےüüüèèè÷÷÷نننééé/¬ے¸¸¸_؟ےِِِوووٌٌٌoإے‏‏‏لللںظےڈزے‎‎‎¯كےةةةُِ÷ذشطًًٌ‎ü‎ًٌٌü‎ün¯ّe“؟]کهييپ_‹¾Vi‚dddmjhUٹ½z´ٌ7¯¬D€°ôc <د جS‡çہ@Ù¾ ¦5™‰پ L0"W#BØ·V Hھôا€™Â¥:ض±ˆ%پˆ0²مشڈ?‰ٌ2يً©‹KPTI+’Ú¯ّمہق{y00<#D‰ے9؛ôرÙ¾Ú˜ظ†ôڈشw¨كے†ْ*Ù†$Û’Ú¯
     
    t6werserv, Jan 24, 2010 IP
  8. ibg

    ibg Member

    Messages:
    25
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    38
    #8
    Then your content is wrong or you're storing the whole image in the database.
     
    ibg, Jan 24, 2010 IP
  9. astkboy2008

    astkboy2008 Peon

    Messages:
    211
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #9
    you must print your content in other header with image format header
    and put this new page in scr
     
    astkboy2008, Jan 24, 2010 IP
  10. astkboy2008

    astkboy2008 Peon

    Messages:
    211
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #10
    you must print your content in other header with image format header
    and put this new page in scr
     
    astkboy2008, Jan 24, 2010 IP