Jump to content


Staff Alumni
  • Posts

  • Joined

  • Last visited

  • Days Won


Posts posted by awjudd

  1. Sounds like a major flaw in the script that was created.  You shouldn't need a separate database for each user / company in the system.  You can do so by having a normalized database instead.


    You will need to provide more information about the application more specifically provide a link to the application because right now this is way to generic for anyone to debug.



  2. You should definitely do it in your query rather than on the PHP side.  By doing it on the PHP side, you are forcing mysql to prepare a stream with information that will never actually be retrieved, it will only be used with mysql_num_rows, which isn't cost effective.


    If you are having performance issues, then I would suggest persisting the count, but up until then you should be fine with a COUNT(comment id), especially if indexed correctly.



  3. I believe that you are looking for any active record implementation out there.  Why not google for one instead of asking us to provide you with one?  There are a ton out there if you just take a bit of time and search for it ...



  4. SQL is a language in its infancy and as such does not support anywhere near what other languages do


    This tells me that you do not know the sheer power of SQL.  Yes you can't do stuff that a functional programming language does, but that is for a specific reason.  It isn't supposed to be able to.  SQL is used to get at and manipulate data, NOT anything else.


    Taking the code from a mysql_query execution and placing it in a stored procedure does not necessarily make it more efficient or faster, in-fact I find it hard to believe it will do either.


    It only allows the query optimizer to know exactly what is going on before hand so that it can pre-determine the most optimal way of getting the information being requested.



  5. Yet again you neglected to use code tags.


    In the database there is no such thing as an array, that is the definition of a table.  If you need to pass in 64 ints, then you could pass it in as a comma separated list and then change that into a table and then JOIN against it.



  6. Add a DISTINCT to it.


    SELECT `event_id` FROM `courses_resultats` 
    WHERE `event_id` = 1 AND `pilote_id` = 2 AND `pilote_id` IN 
         (select * from (SELECT DISTINCT `pilote_id` FROM `courses_resultats` WHERE `event_id` = 1 ORDER BY  (`Finale`+`Bonus`) DESC LIMIT 10)  alias)


    That will remove the duplicate from being returned.



  7. Your DELETE and INSERT are unnecessary, you could likely get away with an INSERT / UPDATE on duplicate query instead.


    I wouldn't iterate through all of the products n your products table because that is pointless.  Instead I would figure out which ones were affected in your $_POST (i.e. you know all fields are named >id<_name, so grab the list of all >id<) and then just process those.



  8. You can either change your PHP code to just not include the WHERE clause if $siteid = 0 (better approach) or you could do as follows:


    $query="SELECT *
    FROM items
    WHERE $siteid<>0 AND siteid=$siteid";



  • 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.