Training, Open Source computer languages

This is page http://www.wellho.net/forum/Writing-PHP/reading- ... mysql.html

Our email: info@wellho.net • Phone: 01144 1225 708225

 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
reading image from mysql

Posted by fastlife (fastlife), 24 October 2007
Hi,

http://www.wellho.net/solutions/php-example-php-form-image-upload-store-in-mysql-database-retreive.html

i am using this code with little modification like i have moved // Insert any new image into database
code to a separate file.

and reading image in a different file.  My problem is that it is not showing image instead it is showing me binary data. (I want to print it in the page every time it loads) Please help me

Regards,
Madhulika



Posted by admin (Graham Ellis), 25 October 2007
I'm guessing that you haven't added a call to the PHP header function to set the content type, but without seeing you code that has to be a guess

Posted by fastlife (fastlife), 25 October 2007
thanks for replaying.

I am pasting piece code for you to view.

<tr>
                 <td width="100%" colspan="3">
                 <p align="center"><b>
                 <font face="Verdana" size="2" color="#515151">MODIFY USER                </font></b></td>
               </tr>
                       <tr>
                 <td width="8%">&nbsp;</td>
                 <td width="21%">&nbsp;</td>
                 <td width="71%">&nbsp;</td>
               </tr><?
                       $UID=$_GET[id];
$gotten = @mysql_query("select * from users where user_id=$UID");
if ($row = @mysql_fetch_assoc($gotten)) {
      $bytes = $row[picture1];
} else {
       $errmsg = "There is no image in the database yet";
       $title = "no database image available";
       }
if ($_REQUEST[gim] == 1) {
       header("Content-type: image/jpeg");
       print $bytes;
       exit ();
       }

                   ?>
                                       <input type="hidden" name="txtMenuID" size="60" value="<?=$row["user_id"]?>">

                             <script language="javascript1.2">
                             editor_generate('txtDescription1');
                       </script>
           <tr>                                                
                 <input type="hidden" name="MAX_FILE_SIZE" value="50000">
                 <td width="30%" class='style9'>Picture 1</td>
                 <td width="70%"><img src=?gim=1 width=144>
<br><input type="file" name="txtPic" size=30>
                 
                       </td>      
           </tr>



This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

© WELL HOUSE CONSULTANTS LTD., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho