
a1amattyj
Members-
Posts
114 -
Joined
-
Last visited
Never
Everything posted by a1amattyj
-
Hello, The following query: I would like to select only distinct rows with respect to deals.handset (no 2 results from this query will spit out the same deals.handset value). How would I go about this? (deals.handset is indexed, and is an integer value) Thank you so much, Matt
-
Hello, I've got 2 images (please see attached: top3.jpg, side4.jpt) (using these 2 as an example) I want to overlay them onto the image (also attached temp1.jpg) However, the corner gets cut off, as can be seen (temp3.jpg) Im wondering if I can overlay them using PHP at the 45deg angle? Currently using $dest = imagecreatefromjpeg($source); $src = imagecreatefromjpeg($image); if($part == 1) { // main image imagecopymerge($dest, $src, 0, 80, 0, 0, 321, 321, 100); } else if($part == 2) { // the top image imagecopymerge($dest, $src, 0, 0, 0, 0, 401, 80, 100); } else if($part == 3) { // the side image on the right imagecopymerge($dest, $src, 321, 1, 0, 0, 80, 401, 100); } imagejpeg($dest, $save); imagedestroy($dest); imagedestroy($src); Thank you!
-
Hello, Im trying to optimize the following query: Where I'm altering the manufacturer_id. Here is an explain: And the tables (omitted some of the fields that are not needed here); Any help would be much appreciated. Thanks!
-
Thank you very much, that done it!
-
Thanks for the response, here are the new outputs: Thanks
-
Hello, I'm trying to speed up a search function. Here is an example query: Deals Table: deal | tarrif text | int(15) Tariffs Table: tarrif_numericid | network_numericid | contract_length | anytime_mins | texts | data | cost_month | someother coumns.. int(15) | int(15) | int(15) | int(15) | int(15) | int(15) | decimal(15,2) | ... Each of the coumns above depends on what the user searches for, please see query above for example. Here are my current indexes: 1) h.tarrif_numericid 2) h.contract_length h.anytime_mins h.texts h.data h.cost_month 3) d.tarrif Explain: Any help would be greatly appreciated increasing the speed (from the current 8s)!
-
Hello, Is it possible anyone could hlep me out in optimising the following query? Produces: Showing rows 0 - 19 ( 20 total, Query took 20.4553 sec) The explain for this query: Tables: Deals table has 1.2m records and tariffs has 2500 records. Any help would be much appreciated! Thank you
-
Thanks for the help, I've implemented all the changes you have given but the speed is still an issue: Showing rows 0 - 19 ( 20 total, Query took 4.4153 sec) [popularity: 84 - 80] SELECT DISTINCT * FROM deals d JOIN handsets h ON ( d.handset = h.handet_numeric ) WHERE h.manufacturer_id = '9' ORDER BY d.popularity DESC LIMIT 20 Thanks!
-
Hello, I currently have 2 tables, a deals table and a handset table. Now, only the handset table has a reference to a manufacturer. I wish to list the top 20 DEALS for a given manufacturer. So the easiest way to do this would be to use the handset table; each deal is linked to a handset, and hence, has the manufacturer ID required to produce results. Tables below: 'Deals' Table - 2.3m rows 'Handsets' Table - 5000 rows Here is the query I have come up with which isn't giving me fantastic results, for manufacturer ID 3, top 20. SELECT distinct * FROM `deals` LEFT JOIN `handsets` ON deals.handset = handsets.handet_numeric WHERE `handsets`.`manufacturer_id` = '3' ORDER BY `deals`.`popularity` DESC LIMIT 20 This query takes around 53 seconds too! Not very well optimised.. Wondered if anyone could let me know a way to optimise it? I've added an index for handsets.handet_numeric. Thanks
-
Thank you guys, very informative!
-
Hello, Trying to get all content within paragraph tags. Im using: preg_match("#<p>(.*)</p>#i", $contents, $match); There are around 8 paragraphs on this page, but it only matches two - and thats the first <p> tag with the last </p> tag. Not to sure what I should change (.*) too? Thanks
-
Hello, I'm trying to convert a paragraph of text which is already html formatted. I wish to find keywords, such as, 'PHP', which are contained in the paragraph, and replace them with a link, for example <a href="http:/www...">PHP</a> str_replace('PHP', '<A href=""....">PHP</a>', $content); My problem arises when some of these keywords are already contained in a link, so say, visit PHP website, is all one link, so str_replace would simply convert the PHP in this string, to two links for one single word. <a href="">visit <A href=""....">PHP</a> website</a> How could this problem be resolved? Thanks