RE: images with mysql
Don't forget that the images can be stored *outside* the root dir. Access them using ../../ until you reach your img dir. There's no way to get to the images directly then. Paul -Original Message- From: lasse [mailto:[EMAIL PROTECTED] Sent: Friday, March 21, 2003 12:14 AM To: unlisted-recipients:; no To-header on input Cc: [EMAIL PROTECTED] Subject: Re: images with mysql sure you can. And i don't mind you disagreeing with me either =) Although, if the solution/site is meant to be used by other than people who know something about the webserver i don't think it's a good solution. I can imagine writing something that reads the htaccess-file and edits it... but i don't like the possible securtyissues with that. Besides... if you render a page with a selectbox from mysqltables and another with images and let the user match them together, it's idiotproof =) If you have a php(or whatever)-file wich sole purpouse is to check users rights and render images it can also always check if you have the right cookies. If you've been to the right previous page to see that picture, if not redirect to '/'; Do you get my point? I still believe that the blob i my saviour... (despite the obvious loss of performance) On Thu, 20 Mar 2003, B. van Ouwerkerk wrote: You can use other ways to protect your images from linking by others. Like with Apache and htaccess.. I don't agree with you on your opinion that it's easier to code. If you insert a link into your database all you have to do is retrieve it and push the link to the browser. B. At 20:18 20-03-2003 +0100, lasse wrote: hey all.. new to the list. Just my 5 cents... I think it's better to store images in the database, sure you loose a bit in performance, but it's easier to code. The way i've done it before is always a separate render.php (or what ever) that compares the users rights to view that image, get's the blob from the database, sets right content-type for the page and then renders the binary data. That way... you can control frames/design (direct links to images can be avoided) und so weiter... //lars On Thu, 20 Mar 2003, B. van Ouwerkerk wrote: I assume it is, have not tested it.. If you need to fetch the files from the database your app needs to wait until it has recieved the data. If you only store name/path info it will take less time to fetch the data, ship it off to the browser which can start fetching the images without connecting to the database again. Sounds pretty logical.. and it gets worse if your site is hosted by an ISP who is using a database server running on a seperate box.. B. At 21:35 20-03-2003 +, Lai Liu-yuan wrote: Well, this may be off topic. In my case, I store tens of thousands of images, gradually growing. All of them are quite small, most around 30*30 gray scale. Would it still be faster to store them on disk? On Thu, 20 Mar 2003 13:57:06 +0100 B. van Ouwerkerk [EMAIL PROTECTED] wrote: IMHO it's better to store a link. I have seen databases (not MySQL) getting corrupted because the file inserted was to big. For the visitor it doesn't really matter whether you put it into the database or not. A link is less difficult and you don't have to retrieve pictures from the database so it might be quicker.. B. At 18:34 20-03-2003 +, Lai Liu-yuan wrote: I am now having a database storing images of chinese characters for research purpose. I wrote a program to store and retrieve them. My images are of type ppm. This is how I designed my table: mysql describe poor; +++--+-+-+---+ | Field | Type | Null | Key | Default | Extra | +++--+-+-+---+ | cc | char(2) binary | | | | | | width | int(1) | YES | | NULL| | | height | int(1) | YES | | NULL| | | data | blob | YES | | NULL| | +++--+-+-+---+ Just have to be really careful in storing binary data. Hope this help. On Thu, 20 Mar 2003 10:34:19 +0100 [EMAIL PROTECTED] wrote: Hi! I have a problem with my MySQL I need to have some a images related with an item for example -- ! author ! date of birth an death ! image! -- How can I define the field for the images? I have read that LONGBLOB could be useful for large objct like images, but I can't understand how to set it in my database... Thank you in advance stefano -- S t e f a n o C a r d o
RE: sql or import file
The following should do the trick mysql LOAD DATA file_name.ext INFILE INTO TABLE table_name Paul -Original Message- From: Andrew [mailto:[EMAIL PROTECTED] Sent: Friday, March 21, 2003 3:58 AM To: [EMAIL PROTECTED] Subject: RE: sql or import file Hi Paul Its a backup of phpbb so its a flat file with the ext .sql I just didn't want to spend the next 8 hours cutting and pasting :) Andrew -Original Message- From: Paul Larue [mailto:[EMAIL PROTECTED] Sent: 21 March 2003 23:46 To: [EMAIL PROTECTED] Subject: RE: sql or import file Andrew, Any extension you like will do it. How do you do the import? Are you importing a MySQL db or data from a flat file? Paul -Original Message- From: Andrew [mailto:[EMAIL PROTECTED] Sent: Friday, March 21, 2003 3:41 AM To: MySQL-Lista Subject: sql or import file In phpMyAdmin 2.3.0 the 'Or Location of the textfile ' instead of running a sql statement does this have to be a txt file or can it be a .sql file? Or if it is a .sql can I just rename the file so it is a txt file? Why is importing a large file inot MySQL so damn difficult. It would be so easy for the backup not to happen as opposed to easily backing up a DB that cannot be restored. Its like having a nice pair of shoes you cant wear! Andrew ** Information in this email is confidential and may be privileged. It is intended for the addressee only. If you have received it in error, please notify the sender immediately and delete it from your system. You should not otherwise copy it, retransmit it or use or disclose its contents to anyone. Thank you for your co-operation. ** - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.463 / Virus Database: 262 - Release Date: 17/03/2003 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
[MySQL] InnoDB - Updating a parent table won't update the child table
Hi all, I created 2 tables in MySQl with the following statements == CREATE TABLE employees ( emp_id INT NOT NULL AUTO_INCREMENT, emp_last_name TINYTEXT NOT NULL, emp_first_name TINYTEXT NOT NULL, emp_nick_name TINYTEXT NOT NULL, emp_date_joined DATE NOT NULL, emp_date_left DATE, emp_title TINYTEXT NOT NULL, emp_group CHAR(50), emp_address TINYTEXT NOT NULL, emp_city TINYTEXT NOT NULL, emp_phone CHAR(7) NULL, emp_mobile CHAR(7) NULL, emp_national_id CHAR(14) NOT NULL, emp_social_security CHAR(8) NOT NULL, emp_tax_ac CHAR(8) NULL, PRIMARY KEY (emp_id), KEY (emp_group), FOREIGN KEY (emp_group) REFERENCES employee_groups(grp_name) ON DELETE SET NULL ON UPDATE CASCADE ) TYPE=InnoDB COMMENT=Stores information about employees in company CREATE TABLE employee_groups ( grp_id INT UNSIGNED NOT NULL AUTO_INCREMENT, grp_name CHAR(50) NOT NULL, grp_overtime_paid BOOL NOT NULL, PRIMARY KEY (grp_id), INDEX (grp_name)) TYPE=InnoDB COMMENT=Stores group names and their properties == The field employee_groups.grp_name is 'mapped' to employees.emp_group and the referential integrity is set all the associated fileds to NULL when the parent record is DLETED and to CASCADE when the parent record is UPDATED. Creating the tables is fine. Inserting data in the tables is fine too. But when I try to update a record in employee_groups, MySQL returns the following error mysql UPDATE employee_groups SET grp_name = FOO WHERE grp_id = 1; ERROR 1217: Cannot delete a parent row: a foreign key constraint fails Why is it telling me that I'm trying to delete the record when I'm only doing a simple update? Deleting the records is ok, MySQl sets the associated fields to NULL. But the update WON'T work... Any clue? Thanks in advance Paul - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
MySQL Client on Linux won't connect to MySQL Server on XP
Hi all, I got MySQL 3.23.55-nt running on XP and MySQL Client 3.23.36 running on Linux Red Hat 7. I'm trying to have the client connect to the server but I get the same error all the time: [EMAIL PROTECTED] /root]# mysql -h 10.0.0.41 -u guest ERROR 1130: Host '10.0.0.220' is not allowed to connect to this MySQL server Could it be that the server and the client are not running the same version and OS? Actually this situation is only a simulation of the future setup which will be a win2k box holding the MySQL Server and the Linux box still holding the client. Apache will run on the linux box as well as PHP so that I can connect to mysql. I'd be glad to hear from people having a similar setup and who would be willing to give me tips on problems I could encounter as well as some hints. Thanks in advance Paul - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
startingMySQL with InnoDB on Red Hat
Hi All, I'm quite a novice with Mysql and more than a newbee with Linux but I managed to install Red Hat on an x86 and installed MySQl too. Now I need to have InnoDB support. I installed MySQl on my notebook too (winxp) and edited my.cnf to start innodb and set all the required params. I use my notebook for testing... The problem is that using the same my.cnf (at least the same params for InnoDB) in the my.cnf on the linux box doe not start MySQL. The Service fails. whereas on the xp machine it does... very well! Any help GREATLY appreciated. I still cannot understand why it won't work. My only guess is that onnodb does not have the approprioate permissions to read/write or something like that. Below is my my.cnf [mysql] section InnoDB part innodb_data_file_path = ibdata1:10M:autoextend set-variable = innodb_buffer_pool_size=70M set-variable = innodb_additional_mem_pool_size=10M set-variable = innodb_log_file_size=20M set-variable = innodb_log_buffer_size=8M innodb_flush_log_at_trx_commit=1 Thanks for the help. Paul - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php