Jump to content

awjudd

Staff Alumni
  • Posts

    422
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by awjudd

  1. First thing I see are all of the public member variables but then you have setters for them. I would make them all private. What happens if I want more than 1 CC / BCC email address? Do I have to make the semi-colon separated list myself? You are also forcing there to be a TO address. What if there isn't (i.e. a mailing list where you don't want to show the members of it so everyone is BCC'd)? You never call the setContentType nor the setCharset functions so they will always be empty. Your send method: - you call $this -> setFromName () twice and then you start cycling through everyone in the TO list ... why are they not all sent to with one email? - if any 1 mail is sent succesfully the $sent flag will be set to TRUE and it will mark it as a success - continue in foreach loop is useless there ... it will just jump up to the beginning of the loop anyways (no other code below it) - if ( $sent = TRUE ) ... you are assigning TRUE to the value so that will always evaluate to true. All you would really need there is return $sent; because it is already either TRUE / FALSE Another small thing I noticed, no comments throughout the code ... especially on those public functions Hope this helps. ~juddster
  2. Side Note: since login_date is an INT, you don't need to put the number in quotes. You only need to do that for non-numeric data types. ~juddster
  3. So that is about 20 connections for each page that is loaded. If there are 20 people on the site, that is 20 * 20 = 400 connections to your database. This is what I'm guessing the problem is. I would change this object so that it follows the Singleton pattern so that there is ever only 1 instance in existence. ~juddster
  4. How many times do you instantiate the connection object in your code? EDIT: Why did you close your other topic saying the *exact* same thing? ~juddster
  5. You don't need the LEFT JOIN because it will just slow it down in this case (since you have a condition on the RH table anyways which will kill any NULLs). I would put a FOREIGN KEY (use INNODB because MyISAM doesn't support FKs) constraint on the users_id column so that the optimizer is able to speed that up a bit. But yes, it works. That said, I personally would change the INT for the time to DATETIME. You gain lots of additional functionality and readability of your queries for a few more bytes ... ~juddster
  6. awjudd

    quick UPDATE

    But it is now at a different spot ... Looking at the definition for CONCAT (http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_concat) you can give it a number. UPDATE `apartments` SET mainImage = CONCAT(ID-SupplierID-0,'.jpg') WHERE InternalSupplierID=7;
  7. awjudd

    quick UPDATE

    You are missing the quotes around your string ... and you have 1 too many quotes at the end ... UPDATE `apartments` SET mainImage = CONCAT(CAST(ID-SupplierID-0 AS VARCHAR(50)),'.jpg') WHERE InternalSupplierID=7;
  8. awjudd

    Query issue

    If the result sets are going to be the same, you could make a function and then call that all 4 times just passing in the array coming back from the database. I noticed that you had LIMIT 1 at the end of your query but all of your mysql_fetch_array's are in a while loop ... is this for any particular reason? If you want multiple rows, you should remove the LIMIT 1 from the query and if you want only one row returned, you should remove it from being in a loop since it isn't necessary. That said, you can probably join all 4 of your queries together and with a bit more logic split all of the sections up just by watching the subcategory until it changes ... ~judda
  9. Sorry Bill, as Keith mentioned, I had a typo ... it should be intval instead of interval. ~judda
  10. Your syntax error is actually lower than that ... it is: <?php $sql = "SELECT a.Id, b.Make, a.Price FROM ActualCarsTable a INNER JOIN CarMakeTable b ON a.Make = b.Id WHERE b.Id = ".interval($_REQUEST['make'])"; I removed the ' from around each of the tables in the JOIN. If you want to delimit it somehow, you should be using the backticks (`). $sql = "SELECT a.Id, b.Make, a.Price FROM ActualCarsTable a INNER JOIN CarMakeTable b ON `a`.`Make` = `b`.`Id` WHERE `b.Id` = ".interval($_REQUEST['make'])"; ~judda
  11. I agree with Pikachu here ... If the host was able to add the information into your table, then they are using a different username and password combination since INSERT is not allowed for your user. ~judda
  12. Right table = the table on the right hand side of the join. Left table = Submit Right table = select angler, max(length) as mlength from submit group by angler ~judda
  13. If you have a 1-many relationship as you do, including the values will expand based on fact that those are different values, therefore making the sets different. You could do a GROUP_CONCAT if you wanted to in order to combine them into one record ... but now I'm not sure what you are trying to do. ~judda
  14. I'm guessing that the left join is returning multiple rows. You could either GROUP BY all of the fields or SELECT DISTINCT. Either way will work at killing the duplicates. ~judda
  15. I'm guessing that the right table doesn't return the 8 extra rows you were expecting or something along those lines. ~judda
  16. I would add two more indices on top of the PRIMARY KEY which was previously mentioned. They are on the following sets: - (story_id, userc, date ) - (story_id, userc ) This should speed up your queries a bit. However it won't be able to help the query with the UPPER and LEFT in it since those values don't have indexes on them. ~judda
  17. angler is being returned by both the submit table and the subquery. In order to fix that you just need to qualify the angler which is in the outermost select statement (i.e. dt.angler) ~judda
  18. Couldn't you just do it upon retrieval from the database (i.e. in your SELECT query?) ~judda
  19. DELETE FROM TABLE WHERE catid != 40 There is no such thing as DELETE * FROM ... ~judda
  20. Use mysql's LEFT function (http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_left)? ~judda
  21. Then fully qualify the field name (table.field) in your returned table? ~judda
  22. Have you looked at WordPress? That is the most common blog software out there. ~judda
  23. While you are at it ... can you help me download the interwebs?
  24. I personally use vim for all of my development. It is nice, light weight and can be opened in a screen session and then accessed from anywhere (if hosted on a server). All around powerful editor ~judda
  25. $_POST[foo] and $_POST['foo'] both work because PHP will automatically upconvert single words of text that it doesn't know as a constant to a string. That said, using $_POST[foo] is slower because not only does it cause notices to be thrown but it has to check for any definitions before it can assume that it is a string. Sample: <?php $arr = array (); for ( $x = 0; $x < 1000000; $x++ ) { $arr [ foo ] = 'bar'; } ?> Time of execution: $ time php test.php real 0m1.641s user 0m1.424s sys 0m0.044s Versus: <?php $arr = array (); for ( $x = 0; $x < 1000000; $x++ ) { $arr [ 'foo' ] = 'bar'; } ?> Run Time: $ time php test.php real 0m0.467s user 0m0.292s sys 0m0.052s Yes, this is a highly exaggerated case but it is a decent example of how it is bad ~judda
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.