-
Posts
969 -
Joined
-
Last visited
Everything posted by Destramic
-
hey guys I'm trying to join tables together but i want to be able to have multiple conditions for the same column. ie: WHERE sv.value = 'Alarm Clock' AND s.specific_id = '15' AND sv.value = 'New' AND s.specific_id = '19' now i know this is complicated as you can't see my table structure and table data but here is the query i'm trying to execute which returns 0 results when having multiple conditions from same column... SELECT i.title FROM items i LEFT JOIN category_specifics cs ON cs.category_id = i.category_id LEFT JOIN sub_category_specifics scs ON scs.sub_category_id = i.sub_category_id LEFT JOIN sub_sub_category_specifics sscs ON sscs.sub_sub_category_id = i.sub_sub_category_id LEFT JOIN sub_sub_sub_category_specifics ssscs ON ssscs.sub_sub_sub_category_id = i.sub_sub_sub_category_id INNER JOIN (SELECT s2.specific_id FROM specifics s2 LEFT JOIN category_specifics cs2 ON cs2.specific_id = s2.specific_id LEFT JOIN sub_category_specifics scs2 ON scs2.specific_id = s2.specific_id LEFT JOIN sub_sub_category_specifics sscs2 ON sscs2.specific_id = s2.specific_id LEFT JOIN sub_sub_sub_category_specifics ssscs2 ON ssscs2.specific_id = s2.specific_id ) AS `s` LEFT JOIN specific_values sv ON sv.specific_id = s.specific_id LEFT JOIN item_specific_values isv ON isv.item_id = i.item_id WHERE MATCH (i.title, i.description) AGAINST ('clock' IN BOOLEAN MODE) AND isv.specific_value_id = sv.specific_value_id AND sv.value = 'Alarm Clock' AND s.specific_id = '15' AND sv.value = 'New' AND s.specific_id = '19' GROUP BY i.item_id if i take away AND sv.value = 'Alarm Clock' AND s.specific_id = '15' -------OR --------- AND sv.value = 'New' AND s.specific_id = '19' then it'll works i'll be happy to post table structures and data if needed...hopefully you can see what i'm trying to do and tell me if it's possible or not and what it is i need to be doing. any help would be appreciated and like i said i can provide data if need. thank you
-
Column 'description' cannot be part of FULLTEXT index
Destramic replied to Destramic's topic in MySQL Help
removing DEFAULT CHARSET=utf16 worked a charm thanks barand -
Column 'description' cannot be part of FULLTEXT index
Destramic replied to Destramic's topic in MySQL Help
thank you...ok i installed 5.7.10...but i still get same error when executing query =/ -
hey guys im trying to set to columns as a full text index but im receiving an error: this is where the fault lies but i dunno why im getting the error...im using innodb engine for the table on mariadb 10 FULLTEXT `items_FULLTEXT` (`description`, `title`), this is the sql i'm executing which is failing....i know innodb now support fulltext so where am i going wrong here please? CREATE TABLE `items` ( `item_id` int(11) NOT NULL AUTO_INCREMENT, `user_id` int(11) NOT NULL, `category_id` int(11) NOT NULL, `sub_category_id` int(11) NOT NULL, `sub_sub_category_id` int(11) DEFAULT NULL, `sub_sub_sub_category_id` int(11) DEFAULT NULL, `user_address_id` int(11) DEFAULT NULL, `condition_id` int(11) DEFAULT NULL, `title` varchar(90) NOT NULL, `description` text NOT NULL, `auction` int(11) NOT NULL, `buy_now` tinyint(1) NOT NULL DEFAULT '0', `starting_price` decimal(15,2) NOT NULL, `listing_duration` enum('1','3','7','10','30') NOT NULL, `buy_now_price` decimal(15,2) NOT NULL, `quantity` int(11) NOT NULL DEFAULT '1', `offers_accepted` tinyint(1) NOT NULL DEFAULT '0', `start_timestamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `dispatch_time` enum('Same Day','1 Working Day','2 Working Days','3 Working Days') NOT NULL, `returns` int(1) NOT NULL DEFAULT '0', `return_policy` text, `free_delivery` int(1) DEFAULT '0', `free_delivery_condition` enum('Town/City','County','Country','Continent','MENA Region','Worldwide') DEFAULT NULL, `collection` int(1) DEFAULT '0', `collection_only` int(1) DEFAULT '0', `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `personal_delivery` int(1) DEFAULT '0', `personal_delivery_distance` int(10) DEFAULT '0', `persnal_delivery_price` decimal(12,2) DEFAULT '0.01', `draft` int(1) NOT NULL DEFAULT '0', PRIMARY KEY (`item_id`), FULLTEXT `items_FULLTEXT` (`description`, `title`), UNIQUE KEY `items_item_id_UNIQUE` (`item_id`), KEY `items_user_id_INDEX` (`user_id`), KEY `items_category_id_INDEX` (`category_id`), KEY `items_sub_category_id_INDEX` (`sub_category_id`), KEY `items_user_address_id_INDEX` (`user_address_id`), KEY `items_condition_id_INDEX` (`condition_id`), CONSTRAINT `items_category_id_FOREIGN_KEY` FOREIGN KEY (`category_id`) REFERENCES `categories` (`category_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `items_condition_id_FOREIGN_KEY` FOREIGN KEY (`condition_id`) REFERENCES `conditions` (`condition_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `items_sub_category_id_FOREIGN_KEY` FOREIGN KEY (`sub_category_id`) REFERENCES `sub_categories` (`sub_category_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `items_user_address_id_FOREIGN_KEY` FOREIGN KEY (`user_address_id`) REFERENCES `user_addresses` (`user_address_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `items_user_id_FOREIGN_KEY` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=1243 DEFAULT CHARSET=utf16; thank you
-
i changed all ports to 80 and i managed to get it to work perfectly now....thank you guys for your help
-
ok i turned off my windows firewall completely but im still getting no joy...if you could please help... here is the rule i did for my firewall opened port 8080 on my router followed by my nginx config containing 192.168.1.80 error_log logs/error.log; events { worker_connections 1024; } http { keepalive_timeout 300; proxy_read_timeout 300; proxy_connect_timeout 300; fastcgi_read_timeout 300; server { listen 8080; server_name 192.168.1.80; client_max_body_size 500M; index index.html index.htm index.php; root c:/nginx/html; location / { autoindex on; } location = /favicon.ico { log_not_found off; } location ~ .php$ { fastcgi_pass 127.0.0.1:9000; include fastcgi.conf; fastcgi_index index.php; fastcgi_read_timeout 300; } } } hope you can tell me where i've gone wrong? thank you
-
yeah i tried ngrok but would like to do it so my ip can be used as the web address....ngrok created a url like so: http://29749e5e.ngrok.io
-
ok notes taken thank you. nginx config: listen 8080; server_name 192.168.1.80; i've made port 8080 as a new inbound rule on my firewall for nginx.exe and port 80 on my router forwarding to port 8080 now when i get someone to try connecting to my (ip):80 it doesn't connect...any ideas on this please requinix? i'm sure i've done everything right thank you
-
brilliant that worked like a charm....also very east to use and it broadcasted thanks gizmola ngork http 8080 requinix i'd like to know how to do it via my router also....here is what i've done. nginx operates on port 8080 locally...i've added a port forwarding on my router (port 80) for port 8080 (nginx) as seen in image above... i just added a rule in firewall for port 80 to be public, but i noticed there is a few other things that operate on port 80 in my firewall....so should i make it unique? here is my nginx conf...do i need to alter this too? worker_processes 1; error_log logs/error.log; events { worker_connections 1024; } http { keepalive_timeout 300; proxy_read_timeout 300; proxy_connect_timeout 300; fastcgi_read_timeout 300; server { listen 8080; server_name 127.0.0.1; client_max_body_size 500M; index index.html index.htm index.php; root c:/nginx/html; location / { autoindex on; } location = /favicon.ico { log_not_found off; } location ~ .php$ { fastcgi_pass 127.0.0.1:9000; include fastcgi.conf; fastcgi_index index.php; fastcgi_read_timeout 300; } } } thank you for your help guys
-
hey guys, i'm trying to set up router so my local host can be visible to users...I've altered options in my router port forwarding but i'm unable to get it to work. i'm currently using nginx on my local host using port 8080 so i'm able to connect via: http://127.0.0.1:8080/ here are the options i've changed in my router: (port 21 for FTP 80 for nginx server) after there alterations i've tried to connect with my ip followed by the port (ip:80) and also http://192.168.1.1:80 but its not working. can anyone please give me advise on how i can get this working? thank you
-
oh yeah that would of helped...i'm getting these two errors still: mod_fcgid: read data timeout in 45 seconds, referer: http://bisi.bid/list-item End of script output before headers: index.php, referer: http://bisi.bid/list-item thank you
-
hey guys i've made a upload script for my site but i'm getting a server internal error 500 when selecting 3+ files at once, but works fine when uploading singular files. when the user browses and selects a image to upload it's send to my send_image() function which will send the image file, where its added to the server via php in my uploaded script...each file has its own request. here is the function function send_image(method, selector, filename, file, cover){ var data = new FormData(), xhr = XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"), message = 'Uploading ' + filename; if (method !== 'upload'){ file = JSON.stringify(file); } if (method === 'crop'){ message = 'Editing ' + filename; } else if (method === 'restore'){ message = 'Retoring ' + filename; } else if (method === 'remove'){ message = 'Removing ' + filename; } else if (method === 'change_cover_image' || method === 'set_cover_image'){ message = 'Changing cover image'; } loader.display(message); if (method === 'upload'){ data.append('cover', cover); } data.append('method', method); data.append('file', file); xhr.open('POST', 'http://bisi.bid/ajax/image', true); xhr.upload.onprogress = function(e) { if (e.lengthComputable) { var percentage = Math.round((e.loaded * 100) / e.total); progress.display(message, percentage); if (percentage === 100){ loader.stop(message); } } } xhr.onerror = function () { upload_status('Image failed to upload.'); }; xhr.onreadystatechange = function(){ if (xhr.readyState == 4) { if (xhr.status == 200) { if (method.match(/^(upload|crop|restore)$/)){ var src = this.responseText; selector.attr('src', src + '?time=' + new Date()); selector.data('uploaded', true); $('#images-uploaded').text($("li[id^='image-'] img").length); } } else { upload_status('Image failed to upload.'); } } console.log(xhr.responseText); console.log(xhr.readyState); console.log(xhr.status); console.log(xhr.statusText); }; xhr.send(data); return xhr; } i believe the error i'm getting is because of the server configuration i'm getting these errors so i made changes to my server config files nginx.config php.ini upload_max_filesize = 40M post_max_size = 40M after i made changes i tried to upload 5 images at once but the server comes back with internal error 500. images I'm uploading altogether are about 8mb. has someone come across this before?...any help on this matter would be appropriated...if you require further details/code please let me know. thank you
-
what a plonker i am...i took away setting the cover and it worked as i wanted it to UPDATE item_images im1, item_images im2 SET im1.path = im2.path, im2.path = im1.path WHERE im1.item_id = im2.item_id AND im1.path = :cover_image_path AND im2.path = :image_path AND im1.item_id = :item_id sorry for being a fool! haha...thank you for your help barand
-
yeah cover column dosn't move....here is results upon select before sql. image_id item_id path cover --------------------------------------------------------------------------- 13 58 1447700481.jpg 1 14 58 1447700522.jpg 0 --------------------------------------------------------------------------- after sql execution image_id item_id path cover --------------------------------------------------------------------------- 13 58 1447700522.jpg 0 14 58 1447700481.jpg 1 --------------------------------------------------------------------------- here is the table i'm using CREATE TABLE `item_images` ( `image_id` INT(11) NOT NULL AUTO_INCREMENT, `item_id` INT(11) NOT NULL, `path` VARCHAR(130) NOT NULL, `cover` INT(1) NOT NULL DEFAULT '0', PRIMARY KEY (`image_id`), UNIQUE INDEX `item_images_image_id_UNIQUE` (`image_id`), INDEX `item_images_item_id_INDEX` (`item_id`), CONSTRAINT `item_images_item_id_FOREIGN_KEY` FOREIGN KEY (`item_id`) REFERENCES `items` (`item_id`) ON UPDATE NO ACTION ON DELETE NO ACTION ) COLLATE='utf8_general_ci' ENGINE=InnoDB; somethings not right although it seems it should be...be good to know what's up here. thank you
-
Wasn't changing cover values on mine....I'll have another play when I'm back home...thanks for your reply, I'll let you know how it goes
-
hey guys i've tried to run this query on my database but it only partially works...the images paths will change but the values for cover won't budge table --------------------- item_id path - varchar cover - int(1) -------------------- cover will be 1 or 0 depending if the image is the main image. i can see anything i'm doing wrong here...can someone please shine some light on why both path and cover values are not swapping. here is my sql: UPDATE item_images im1, item_images im2 SET im1.cover = im2.cover, im2.cover = im1.cover, im1.path = im2.path, im2.path = im1.path WHERE im1.item_id = im2.item_id AND im1.path = '1447700522.jpg' AND im2.path = '1447700481.jpg' AND im1.item_id = 58 thank you
-
ok brillaint...if you're saying that seems fine then i'm happy...thanks for your reply and sorry for the delay
-
hey guys i'm half way through making a upload script for my site which consists of js and php...but i'm a little concerned about its functionality and how the best way it should work. here is a screenshot of how it looks when a user will click and upload a picture i used a XMLHttpRequest which moves the image from a temporary directory and uploads to my selected directory...happy days! now i give the user a option to edit image where they can rotate and crop the image (server side) this is where i need help on the scripts functionality please. now when a user uploads a picture it saves onto my server directory...depending on how big the image is it can sometimes take 45 seconds for a 4/5 meg picture to upload which causes problem with the users experience (i think) because...of time...the only way i can see the user editing a image is when it's 100% uploaded and not before....cause if they try to edit before the upload is complete i'm unable to select the image to crop and rotate server side as it wont be uploaded yet. it all just seems like a long process waiting and i'm a bit stuck on what is best to do here. do i continue to allow editing on a image, when its 100% uploaded or is there a better way? i hope my problem is clear enough...also if you'd like to see any code please let me know. thank you
-
changing this in my nginx config sorted it client_max_body_size 500M; works great now...but is this the correct debug info i should be getting? as it spits out xhr.onload twice 99% uploaded 100% uploaded 200 Server got: 100% uploaded done 200 Server got: uploaded js: function upload_image(image, name){ var data = new FormData(); xhr = new XMLHttpRequest(); data.append('image', image); data.append('name', name); data.append('item_id', 2); xhr.open('POST', 'save.php', true); xhr.upload.onprogress = function(e) { if (e.lengthComputable) { var percentage = Math.round((e.loaded * 100) / e.total); console.log(percentage + '% uploaded'); } } xhr.onreadystatechange = function() { if(xhr.readyState == 4 && xhr.status == 200) { console.log("done"); } } xhr.onload = function() { console.log(this.status); if (this.status === 200) { var response = this.response console.log('Server got:', response); } } xhr.send(data); } thank you
- 6 replies
-
- upload_max_filesize
- php
-
(and 1 more)
Tagged with:
-
well i'm using my localhost at the moment...running nginx...so there should be no reason why 413 error should come up =/
- 6 replies
-
- upload_max_filesize
- php
-
(and 1 more)
Tagged with:
-
ok well i did what you said and it came back with Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help http://xhr.spec.whatwg.org/ 413 still 413 error...still working fine on smaller image size thanks for your post
- 6 replies
-
- upload_max_filesize
- php
-
(and 1 more)
Tagged with:
-
hey guys im running a XML HTTP request and i'm getting the error 413 - ie. image too large. I know its js i'm executing but i think its a php problem so i changed some settings in my php.ini post_max_size = 10M upload_max_filesize = 10M here is the js i'm using function upload_image(image){ var data = new FormData(); xhr = new XMLHttpRequest(); data.append('image', image); xhr.open('POST', 'save.php', true); xhr.upload.onprogress = function(e) { if (e.lengthComputable) { var percentComplete = (e.loaded / e.total) * 100; console.log(percentComplete + '% uploaded'); } } xhr.onload = function() { console.log(this.status); if (this.status === 200) { var response = this.response console.log('Server got:', response); } } xhr.send(data); } it works with smaller images but when trying to upload a 4.4 mb image i get the error 413...now i'm a little confused on how i'm getting this error as i've changed my post and upload max sizes is there something obvious i'm missing here please? thank you
- 6 replies
-
- upload_max_filesize
- php
-
(and 1 more)
Tagged with:
-
brilliant..thanks for the help Jacques! $base = "data:image/gif;base64,R0lGODlhPQBEAPeoA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OigeChUmc1K3QTnAUfEgGFgAWt88hKA6aCRIXhxnQ1yg3BCayK44EWdkUQcBByEQChFXfCB776aQsG0BIlQgQgE8qO26X1h8cEUep8ngRBnOy74E9QgRgEAC8SvOfQkh7FDBDmS43PmGoIiKUUEGkMEC/PJHgxw0xH74yx/3XnaYRJgMB8obxQW6kL9QYEJ0FIFgByfIL7/IQAlvQwEpnAC7DtLNJCKUoO/w45c44GwCXiAFB/OXAATQryUxdN4LfFiwgjCNYg+kYMIEFkCKDs6PKAIJouyGWMS1FSKJOMRB/BoIxYJIUXFUxNwoIkEKPAgCBZSQHQ1A2EWDfDEUVLyADj5AChSIQW6gu10bE/JG2VnCZGfo4R4d0sdQoBAHhPjhIB94v/wRoRKQWGRHgrhGSQJxCS+0pCZbEhAAOw=="; function is_image_string($image) { $image = preg_replace('#data:image/[^;]+;base64,#', '', $image); if (@imagecreatefromstring(base64_decode($image))) { return true; } else { return false; } } if (is_image_string($base)) { echo 'yeah!'; }
-
i'm just trying to test to see if image is base64 but i'm getting an error: Warning: imagecreatefromstring(): Empty string or invalid image in ... now i know the image exists cause i found it here: http://jsfiddle.net/casiano/xadvz/ what am i doing wrong here please guys?...also is this the best method to test if a image string? $base = "data:image/gif;base64,R0lGODlhPQBEAPeoAJosM//AwO/AwHVYZ/z595kzAP/s7P+goOXMv8+fhw/v739/f+8PD98fH/8mJl+fn/9ZWb8/PzWlwv///6wWGbImAPgTEMImIN9gUFCEm/gDALULDN8PAD6atYdCTX9gUNKlj8wZAKUsAOzZz+UMAOsJAP/Z2ccMDA8PD/95eX5NWvsJCOVNQPtfX/8zM8+QePLl38MGBr8JCP+zs9myn/8GBqwpAP/GxgwJCPny78lzYLgjAJ8vAP9fX/+MjMUcAN8zM/9wcM8ZGcATEL+QePdZWf/29uc/P9cmJu9MTDImIN+/r7+/vz8/P8VNQGNugV8AAF9fX8swMNgTAFlDOICAgPNSUnNWSMQ5MBAQEJE3QPIGAM9AQMqGcG9vb6MhJsEdGM8vLx8f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RoRKQWGRHgrhGSQJxCS+0pCZbEhAAOw=="; function is_base64_image($image) { if (@imagecreatefromstring(base64_decode($image))) { return true; } else { return false; } } if (is_base64_image($base)) { echo 'yeah!'; } thank you
-
Hey guys just wanted to post the cropping function i made. which goes well with something like this: http://jsfiddle.net/...ramic/ybq2mab5/ if the image you are cropping is smaller/bigger or same size as orginal it will return crop exact for orginal image...works with x y co-ordinates too...hope it can help someone as much as it's helped me thanks for your help guys! function crop($image_source, $selected_x, $selected_y, $selected_x2, $selected_y2, $image_x = null, $image_y = null, $image_x2 = null, $image_y2 = null) { list($orginal_x2, $orginal_y2) = getimagesize($image_source); if (!is_null($image_x)) { if (is_null($image_x2) || $image_x2 === $orginal_x2) { $selected_x -= $image_x; } else if ($image_x2 > $orginal_x2) { $difference = (($image_x2 - $orginal_x2) / $image_x2 * 100); $image_difference = $image_x * ((100 - $difference) / 100); $select_difference = $selected_x * ((100 - $difference) / 100); $selected_x = ($select_difference - $image_difference); } else if ($image_x2 < $orginal_x2) { $difference = ($orginal_x2 / $image_x2); $image_difference = $image_x * $difference; $select_difference = $selected_x * $difference; $selected_x = ($select_difference - $image_difference); } } if (!is_null($image_y)) { if (is_null($image_y2) || $image_y2 === $orginal_y2) { $selected_y -= $image_y; } else if ($image_y2 > $orginal_y2) { $difference = (($image_y2 - $orginal_y2) / $image_y2 * 100); $image_difference = $image_y * ((100 - $difference) / 100); $select_difference = $selected_y * ((100 - $difference) / 100); $selected_y = ($select_difference - $image_difference); } else if ($image_y2 < $orginal_y2) { $difference = ($orginal_y2 / $image_y2); $image_difference = $image_y * $difference; $select_difference = $selected_y * $difference; $selected_y = ($select_difference - $image_difference); } } if (!is_null($image_x2)) { if ($image_x2 > $orginal_x2) { $width_difference = (($image_x2 - $orginal_x2) / $image_x2 * 100); $selected_x2 *= ((100 - $width_difference) / 100); } else if ($image_x2 < $orginal_x2) { $width_difference = (($orginal_x2 - $image_x2) / $image_x2 * 100); $selected_x2 *= (1 + $width_difference / 100); } else { $width_difference = 100 - (($image_x2 - $selected_x2) / $image_x2 * 100); $selected_x2 = $width_difference / 100 * $orginal_x2; } } if (!is_null($image_y2)) { if ($image_y2 > $orginal_y2) { $height_difference = (($image_y2 - $orginal_y2) / $image_y2 * 100); $selected_y2 *= ((100 - $height_difference) / 100); } else if ($image_y2 < $orginal_y2) { $height_difference = (($orginal_y2 - $image_y2) / $image_y2 * 100); $selected_y2 *= (1 + $height_difference / 100); } else { $height_difference = 100 - (($image_y2 - $selected_y2) / $image_y2 * 100); $selected_y2 = $height_difference / 100 * $orginal_y2; } } $image = imagecreatetruecolor($selected_x2, $selected_y2); $image_source = imagecreatefrompng($image_source); imagecopyresized($image, $image_source, 0, 0, $selected_x, $selected_y, $selected_x2, $selected_y2, $selected_x2, $selected_y2); imagepng($image, 'percentage.png'); imagedestroy($image); imagedestroy($image_source); } crop('image.png', 302, 1008, 525, 445, 23, 20, 2000, 1600);