I've tried a couple different paths and double checked them. Permissions are 755. Like I said that exact same SQL statement inserts the correct record from the mysql command line.

mysql> INSERT INTO photo VALUES('', LOAD_FILE("/Library/WebServer/Documents/var/tmp/default_smiley.png"));

does what I want it to do.


On Jan 16, 2004, at 9:38 AM, John W. Holmes wrote:


Jough P wrote:

Greetings all, I can't get LOAD_FILE to work in an INSERT statement from PHP. The generated sql works when you're in mysql but won't work from PHP.
BSDB is my database object.
sql_query basically just does a mysql_query and some error outputting stuff. There error is:
Column 'photo' cannot be null
My SQL statement is:
INSERT INTO photo VALUES('', LOAD_FILE("/Library/WebServer/Documents/var/tmp/default_smiley.png"))

You're inserting two columns in your query, which one is "photo"? I assume the second, which means LOAD_FILE() is returning a NULL? (from your error message at least). The file must be world readable in order for MySQL to read it and insert it into the table. I assume you've doublechecked the path, also?? :)


--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

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

Reply via email to