Jump to content

beyzad

Members
  • Posts

    109
  • Joined

  • Last visited

Everything posted by beyzad

  1. Hi. Ok i think it's still not too late to change my structure then. I'm not sure if i should post it here or not, so here we go: I have a table that contains many informations about incoming orders. The table name is factor. Each order may have any status from 1 to 7. But can only have one of them. Also each order has a unique key stored in 'factor_key' field. There is a long long (i mean time) process that will specify the order status. but no one will now which status will be the end of the order's journey. so i made 7 fields for storing 7 varriable time. Everytime my order's status changed, the time will stored in the respective field. There will be high amount of data in this table. Please tell me how should i change this. Regards.
  2. Hi. That was a nice story Sorry if i refused to use the way you guys said. My database structure is some kinda different with what you think. Regards.
  3. Hi again. Well i think i have to combine it with PHP. So i will export value of all the fields, the use max(). Thanks btw.
  4. Hi there. I have a problem again I have 7 fields named `factor_1_time`,`factor_2_time`,`factor_3_time`,`factor_4_time`,`factor_5_time`,`factor_6_time`,`factor_7_time` and each of them will hold a timestamp. I will never know which one of them have the maximum value. In other word, I dont know which onw of the following fields was updated last. Is there any query to get the field name that holds maximum value? Thanks
  5. Hello. I already did sir. my question is the difference between the two solutions above. Thanks
  6. Hi again. I was thinking about this: there are 2 methods for what i want: 1- Using ORDER BY RAND() 2- Using the method that 'PFMaBiSmAd' said. In both methods above, ALL fields from that table will be selected, then 20 of them will be exported randomly. The difference is in first method, MySQL Will select random rows and in second method, PHP will do that. Plus in the second method, we have 1 more condition in our query. Is the second method better than first by the way? Thanks
  7. Hi again. Yeah. my problem in exactly what you said 'PFMaBiSmAd'. Because of very very large DB, I was looking for the best solution and i think the way you said is cool. Thanks.
  8. Hi. Why you dont wanna rename your image? if you seriously dont want to rename your image, Then you can make a unique directory for each image.
  9. Hi there. I need a query to get 20 random data from my database using some conditions. So here is my code: <?php $max = single_field_q("SELECT MAX(`ads_product_id`) FROM `ads_products`"); $rand = rand(20 , $max); $products = multi_row_q("SELECT * FROM `ads_products` WHERE `ads_product_id`<" . $rand . " ORDER BY `ads_product_id` DESC LIMIT 20"); ?> It will work very well. But if i use my conditions, This will sometimes returns less than 20 results. And sometimes zero results I know why it returns less than 20. Now i need a solution for this. Thanks.
×
×
  • 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.