-
Posts
3,584 -
Joined
-
Last visited
-
Days Won
3
Everything posted by JonnoTheDev
-
I think it is the fact that the submission table uses the INNODB engine containing 250,000 rows that this runs slow. From what I remember it used to be a MYISAM table but kept crashing so it was converted.
-
There are plenty of indexes in use. Look again. scriptId, siteId, userId 1 SIMPLE s ref PRIMARY,scriptId scriptId 1 const 219 Using where; Using temporary; Using filesort 1 SIMPLE u ref siteId siteId 4 s.siteId 389 1 SIMPLE su ref userId,bookmarkUrl,siteId userId 4 u.userId 1 Using where; Not exists Rows do not get deleted from this system
-
I have tried using a temporary table but still results in a slow returning resultset CREATE TEMPORARY TABLE siteUsers SELECT s.siteId, userId FROM site s INNER JOIN user u ON(s.siteId=u.siteId) WHERE s.scriptId='4'; DELETE FROM siteUsers WHERE userId IN(SELECT su.userId FROM submission su WHERE su.bookmarkUrl ='http://www.xyz.com' AND su.scriptId='4'); SELECT siteId FROM siteUsers GROUP BY siteId;
-
OK, so optimizing other peoples queries is not my strong point so here goes. Looking at a social bookmarking manager system that has a list of a few hundred sites. It can record which sites you have posted bookmarks to. Sites may run various scripts, so there may be 100 sites using the same script. The users for each site are also recorded, username, password, etc. The script records each bookmark that is posted on each site by each user. The problematic part is that there is a section that takes a bookmark url, a script number and gives you the sites from that script where the bookmark has not been posted to. This query is taking about 16 seconds to run, Too Slow. Here is the simplified db structure, query, followed by the results of an EXPLAIN. site ====== siteId scriptId url user ====== userId siteId name submission ========== subId siteId userId bookmarkUrl SELECT s.siteId FROM site s INNER JOIN user u ON(s.siteId=u.siteId) LEFT JOIN submission su ON(s.siteId=su.siteId AND u.userId=su.userId AND su.bookmarkUrl ='http://www.xyz.com') WHERE s.scriptId='4' AND ISNULL(su.subId) GROUP BY s.siteId 1 SIMPLE s ref PRIMARY,scriptId scriptId 1 const 219 Using where; Using temporary; Using filesort 1 SIMPLE u ref siteId siteId 4 socialBookmarking.s.siteId 389 1 SIMPLE su ref userId,bookmarkUrl,siteId userId 4 socialBookmarking.u.userId 1 Using where; Not exists
-
XML SimpleXMLElement::__construct() Problem
JonnoTheDev replied to Ruzzas's topic in PHP Coding Help
You do not need this line anymore as the function returns an object $XML = new SimpleXMLElement($XMLFile); -
XML SimpleXMLElement::__construct() Problem
JonnoTheDev replied to Ruzzas's topic in PHP Coding Help
I would personally use the simplexml_load_string() function to return a SimpleXMLElement Object. Use the following to prevent your error. <?php libxml_use_internal_errors(true); // xml contained in $xml $xml = ""; if(!$simpleXML = simplexml_load_string($xml)) { print "Badly formatted XML document"; } else { foreach($simpleXML->entry as $Attribute){ } } ?> -
More along the lines of <?php function doStuff($string) { switch($string) { case "forum": return "display forum"; break; case "list-messages": return "list all messages"; break; default: return "don't know what to do"; break; } } for($x = 0; $x < count($parts); $x++) { print doStuff($parts[$x]); } ?>
-
I have no idea what this site is for, about, and target audience from landing on the homepage. Therefore it breaks the first rule in web design. A user who comes to your site should instantly know what the site is for and not have to click through various pages to find out. i.e I can see the link 'Tutorials', I am expecting tutorials for computer games but instead I get a page with something about coins! Instantly I would click away from your site. The main content area in the center is lost in white as all the focus is drawn to the huge ads in the right column. There is little content on the site. You should have added a lot more dummy copy to show the layout. You may have been better opting for a 100% stretch.
-
Switch / Case is far cleaner than multiple conditional statements.
-
XML SimpleXMLElement::__construct() Problem
JonnoTheDev replied to Ruzzas's topic in PHP Coding Help
Looks like badly formatted XML -
Screenshot [attachment deleted by admin]
-
Yep. Works fine in all of my browsers. FF, Chrome & IE8
-
I can't see any demo on the page that you posted the link to. The only lightbox / ajax demo I can find on that site is at: http://www.xul.fr/javascript/lightbox-ajax-demo.html This works fine in FF & IE 8 Note: Just found this link. There is no AJAX in this but it woks fine in both IE8 & FF http://www.xul.fr/javascript/lightbox-form-demo.html
-
Find another
-
Looks the Same as FPDF. Have a look at the multi-column & tables tutorials to see if they help. http://www.fpdf.org/
-
This is worrying. I don't bat for that team.
-
Why 32 characters? A timestamp is an integer with a length of 10 (INT 10). Convert this. SQL SELECT * FROM site_flash WHERE flash_date > UNIX_TIMESTAMP(CURDATE() - 1) AND flash_date < UNIX_TIMESTAMP() DESC LIMIT 5
-
I have supercalifragilisticexpialidocious tatooed on my schlong.
-
Mines a similar story. The company I now work for joined the synergy of companies that I was already part of. The oppertunity came up for me to transfer as I had the qualifications. Soon learnt the ropes with PHP and the rest of it. After a short period the company broke out of the group and we went it alone.
-
too many automatic redirections were attempted.
JonnoTheDev replied to jarvis's topic in PHP Coding Help
This is the problem ErrorDocument 404 /301.php You are throwing a 404 to 301.php which is then throwing a 301 to a 200. This is the simplest form for your .htaccess # 404 page ErrorDocument 404 /missing.html # 301 redirects Redirect 301 http://www.foobar.com/old.html http://www.foobar.com/new.html Create a general 404 page. I have called it missing.html. On that page you could have a link back to your homepage that the user can click on. Similar to the following: http://www.bbc.co.uk/yhguyg.html Do not use the 301.php file at all Read the following http://www.isitebuild.com/301-redirect.htm -
too many automatic redirections were attempted.
JonnoTheDev replied to jarvis's topic in PHP Coding Help
Are you trying to redirect old urls to new urls? If so, you shouldn't really use code to handle this. You should use your .htaccess file to define your 404 document and any 301 redirects. It seems to me that you are redirecting to the script containing the code above which is then redirecting again. Too many redirects! Google may see this as malicious. If you put the problematic urls in the tool that i gave the link for it will tell you what is happening. -
too many automatic redirections were attempted.
JonnoTheDev replied to jarvis's topic in PHP Coding Help
You are displaying a 301 header and then redirecting. Essentially you are using 2 301 redirects as the header() will use a 301 also. Use this tool to see what is happening. http://www.internetofficer.com/seo-tool/redirect-check/ -
Depends on the project you are working on. Its nice when you get a project where you may need to do a bit of research into something new, add to your repertoire, if it turns out useful you can use it again in other projects. You do get bored with some of the more common jobs, small websites, etc. Taking code from stock libraries and re-using over and over, but hey if it puts money in the bank and food on the table. Things like making blog sites, picture / video upload / galleries, working with forms I find mundane and boring. I tend to focus more on SEO tools than websites as that is the backbone of our company.