Jump to content

cocoscrappy

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Everything posted by cocoscrappy

  1. ALTER DATABASE `myTable` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci
  2. cocoscrappy

    NOW()

    Try this: $off = strtotime("-30 seconds"); $time = date("Y-m-d H:i:s", $off); $res = mysql_query("SELECT id FROM idtrack WHERE timestamp > '$time'"); Not tested...
  3. SELECT * FROM myTable WHERE field LIKE '%php%'
  4. I can use find_in_set, but when i search for '2', it will find me all the numbers containing 2 (210, 12..) It is similar to LIKE, i think No, it won't. Ooops! You know you're right My bad, i tried again and it works both ways! Thank you for your support !
  5. Intead, i use a little php code for this: $cat_wanted = 2; // $_POST[]; $res = mysql_query("SELECT product, category FROM myTable"); while($arr = mysql_fetch_assoc($res)) { $arrs = explode(",", $arr['category']); if(in_array($cat_wanted, $arrs)) echo "Product: ".$arr['product']." is in categories: ".$arr['category']."<br />"; } Sorry for double post! Please post if you find better solutions.
  6. I can use find_in_set, but when i search for '2', it will find me all the numbers containing 2 (210, 12..) It is similar to LIKE, i think
  7. Thanks kickstart! I'll find an alternative.
  8. Hello! I have a little problem when trying to select some products from a table. This is how the table looks like: The query I want to run is SELECT * FROM myTable WHERE category "contains 2 or is 2" I tried LIKE condition (.. WHERE category LIKE '%2%') and it returns only the products whitch has CATEGORY = 2 Help please!
×
×
  • 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.