RE: mysql + php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



James,

The consensus of developers here seems to have been not to store binary objects in the database. Rather store them in the file system and simply store reference records in the database.  It is much easier this way. If doing it differently is not an option for you hopefully someone else on the list has done this. Unfortunately, I'm pretty sure most of us haven't even tried since it is so much simpler to store them in the file system.

Hope this is helpful.

<>< Ryan

-----Original Message-----
From: Will Contact [mailto:willcontactme@xxxxxxxxxxx] 
Sent: Monday, December 08, 2003 1:10 PM
To: php-db@xxxxxxxxxxxxx
Subject:  mysql + php 

hi!

I  am first question of php in this news group. I would like to ask my question about php + mysql. Now I am  programming php+mysql.  I put word, excel, mpeg and any binaries into the mySQL database using php on linux server,But I can take out these binay from mySQL database. I would like to see the files and save my pc from server. So how can I take out from these binaries? If you know it how to take out and show it, please teach and help me how!!.
The information table of mySQL is "objects." So here is the program below;

// database information
create table objects
          b_col blob,
          name varchar(30),
          file_size varchar(30),
          file_date datetime
}
// it works from "insert" SQL  abc.php
    $db = mysql_connect("*****", "***", "****");
    mysql_select_db("***",$db);
    $sql_insert = "INSERT INTO objects(b_col, file_name, file_size,
file_type,file_date) VALUES
('$UploadedFile','$UploadedFile_name','$UploadedFile_size','$UploadedFile_type',now())";

   mysql_query($sql_insert);

//
// But it does not work at. I can not see anything in my browser
    $sql_select = "select b_col, file_name, file_size, file_type, file_date from objects where  file_name like 'gball.gif'";
    	if(!($result=mysql_query($sql_select,$db))){
      			die;
      	}

               $file_name = mysql_result ($result,0,"file_name");
               echo $file_name; 



Regards,
james

_________________________________________________________________
友達と24時間ホットライン「MSN メッセンジャー」、今すぐダウンロード!
http://messenger.msn.co.jp 

--
PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux