-
Posts
422 -
Joined
-
Last visited
-
Days Won
1
Everything posted by awjudd
-
- '/meatspin/si' => 'Meatspin link found!!!', - just because the code says 'meatspin' doesn't mean it is a meat spin link - '/(is_null|isset|empty|intval|strval)/' => 'use type checks instead of type functions', - you are saying don't use things like isset / empty to validate that something was posted ... either you are forcing it so warnings happen or something ... '/\<\?([^=|^php])/' => 'short php tags should only be used to echo content', - short tags shouldn't be use (IMO) because the setting normally varies on each server and you can spend at least 20 minutes investigating an issue with that - '/(TRUE|FALSE|NULL)/' => 'booleans should be lower case', - NULL isn't a boolean - '/(\$[A-Z]+)/' => 'variable names should be lower case', - So someone can't use camel case? $userid instead of $userId? That is horribly less readable IMO this is way too rigid to be of any use ... ~awjudd
-
By using a DELETE query to remove it? ~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
-
storing username and userid in cookies or sessions?
awjudd replied to MDanz's topic in PHP Coding Help
Why not just use PHP's built in sessions? http://php.net/session ~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
-
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. 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
-
URGENT HELP NEEDED VERY SIMPLE BUT I AM STUCK :(
awjudd replied to cobracommander's topic in MySQL Help
You are mixing PHP and your query without actually swapping. $sql="DELETE FROM logs WHERE counters=2 AND " . (time() - 60) . " >= `time`"; ~awjudd -
Load form dynamically based on a dropdown selection
awjudd replied to ranura's topic in PHP Coding Help
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
-
a better way to do this? MySQL in a loop for many items
awjudd replied to StaticFX's topic in MySQL Help
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. http://www.phpfreaks.com/forums/index.php?topic=359210.0
-
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