Search This Blog

Wednesday, November 9, 2011

MYSQL - IF NOT EXISTS ... INSERT INTO

Database MYSQL - tried IF NOT EXISTS ... INSERT INTO but not working.

IF NOT EXISTS (SELECT * FROM tblabc WHERE id = 10547) THEN
INSERT INTO tblabc
(a, b, c)
SELECT a , b, c
FROM tblabc WHERE id = 10547;

END IF;


Finally, this work

INSERT INTO tblabc
(a, b, c)
SELECT a , b, c
FROM tblabc WHERE id = 10547
AND NOT EXISTS (SELECT * 
FROM tblabc WHERE id = 10547);

Wednesday, November 2, 2011

Warning: Please select a file! in Opencart

I'm using Opencart version 1.9.4.3,  windows server 2003, IIS 6 and PHP Version 5.3.8. Try to upload image in opencart and error message "Warning: Please select a file!" prompted.



After check on the php eror log file, The error log show "Warning: File upload error - unable to create a temporary file in Unknown on line 0"

Solution for this issue is edit upload_tmp_dir in php.ini.

For example, change to
upload_tmp_dir = "C:\PHP\temp"

after the finish edit, restart the web server.

Done. Problem solved.