-
Posts
422 -
Joined
-
Last visited
-
Days Won
1
Posts posted by awjudd
-
-
There is no need to use a LEFT JOIN here if you know all teams must be in the teams table, you can just use a regular INNER JOIN (more efficient).
~awjudd
-
-
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.
~awjudd
-
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.
~awjudd
-
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 ...
~awjudd
-
Without your query, nobody can help you.
~awjudd
-
Write a SELECT statement to run after they post to validate the function type?
~awjudd
-
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.
~awjudd
-
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.
~awjudd
-
What isn't working about it?
Please use [ code ] tags when displaying code and actually tell us what the actual problem is.
~awjudd
-
It is much more practical to have 1 database for every year and then you could even archive after X number of years. You can get a fair bit more information out of the database if you had it all in one ...
~awjudd
-
Is there really a need to spawn off a new database for each year instead of just relating everything to a specific year in the code (i.e. have a year code or something in the database?).
~awjudd
-
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.
~awjudd
-
You are mixing PHP and your query without actually swapping.
$sql="DELETE FROM logs WHERE counters=2 AND " . (time() - 60) . " >= `time`";
~awjudd
-
Or pay someone to make it for you.
~awjudd
-
Find a PDF / DOC parser and make that do it for you? There are several online (findable by google).
~awjudd
-
You are going to need to give a fair bit more information because I'm not sure what you are getting at ...
What is the issue you are trying to resolve?
~awjudd
-
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.
~awjudd
-
This topic has been moved to PHP Coding Help.
-
phpmyadmin is a tool to allow you to access your database in a user-friendly way. MyISAM and InnoDB are storage engines for the tables in a database.
~awjudd
-
If $siteid is 0, then 0=0 which is TRUE, so it will return all of the rows.
~awjudd
-
I missed an OR ... but yet again, this is the wrong approach.
$query="SELECT * FROM items WHERE ($siteid<>0 AND siteid=$siteid) OR $siteid=0";
~awjudd
-
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";
~awjudd
-
Yes, this would be a good use of a function assuming you re-use it elsewhere in your code.
~awjudd
Delete product from cart
in PHP Coding Help
Posted
By using a DELETE query to remove it?
~awjudd