Jump to content

Backslider

Members
  • Posts

    18
  • Joined

  • Last visited

Posts posted by Backslider

  1. With your table structure, in order to execute the query you are asking about, mySql (or any other database server, for that matter) will have to search every one of those 25,000 rows every time (that's called a "table scan" and is really

     

    I am sure that if we had you structuring the query that would be the case. Please think about what you are saying before you blurt out your own unknowledgeable fuffle.

  2. it would be polite to thank the person for the expert advice, as well --- but there is no reason to attack someone for trying to help.

     

    I did not attack anybody for trying to help. I called out a person, and rightfully so, for being a troll. Why? The "I know the answer, but I am not going to tell you, work it out yourself".

  3. I'm not sure is the best option but try with this:

     

    $sql='SELECT * FROM table WHERE column LIKE "%' . $user_country_id . '%" ORDER BY some_field';

     

     

    Thanks for the try BagoZonde, however it doesn't meet requirements as it will only return rows that are not NULL and which the ID matches. FIND_IN_SET is better to use than LIKE for comma separated lists (that's what it's for).

  4. Just to give you a reality check on that:

     

    If my table has 25000 rows and I have 256 country IDs, then that gives me a possible 6,400,000 rows in my "normalized" table. Let's cut that in half for a realistic figure: 3.2 milliion rows. You REALLY think that is good??

  5. You need to normalize your data, storing anything in a delimited list in a single row is bad.

     

    I'm really not here to be lectured on what you think is "bad". Were I to delve into CODD hell then I would end up with a table with many millions of rows just for country IDs. That's just plain dumb.

     

    MySQL has absolutely no problem whatsoever with delimited lists.

  6. If you know the Ajax URL, then that is all you need to get the content. How exactly depends on how the site is structured.

     

    If you have permission to use the content, why not just ask them for a database dump? If you don't have permission, then you are very likely breaking the law.

  7. I have a table with a column that lists country ids as a comma separated list.

     

    Often this column is NULL, but other times it is not.

     

    How would I structure a query that checks this column and if not NULL will check if the user's country ID (PHP variable) is in the list of country IDs in the column and only return that row if it is?

  8. Hi, thanks for the reply. I actually solved this as follows:

     

    SELECT model
    FROM products
    WHERE model !=  ''
    AND model !=  '0'
    AND (model REGEXP  '[0-9][a-z]' OR model REGEXP  '[0-9]')
    

  9. And I hate it when a site doesn't tell me that the username I'm trying to login as or the email I tried to use to reset my password isn't valid, and I'm just wasting my time when I'm a real user. ::) The line has to be drawn somewhere.

     

    I think its ok to show that the email is incorrect for password/ username reset/retrieval - I have never seen otherwise. I work almost exclusively on eCommerce systems, so if you cannot remember your username or password you can retrieve them with a valid email address - the login page will NOT tell you and this is as it should be for better security.

  10. At least the error you are seeing is a good one - I agree with Jessica that its output by the application itself. I cringe at the number of applications that will give a message like: "Your password is incorrect" - this immediately tells a hacker that they have a valid user name.

     

    It could be a problem with how the password is salted - may differ between your localhost and staging server, or a case sensitivity issue.

  11. I need to find valid records as part of a database cleanup script.

    What I need is a regular expression that will match, for a single column:

    records containing BOTH numbers AND letters (or any other character).

    records containing ONLY numbers (including decimals)

    Invalid records are those which contain ONLY letters and I do not want these returned, or NULL for the column.

    Anybody good with regex?

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