Jump to content

watsmyname

Members
  • Posts

    226
  • Joined

  • Last visited

Posts posted by watsmyname

  1. What is the data type of your amountFrom  and  amountTo columns?

     

    It would need to be an INT for math comparisons to work. Also, by putting the '1000' inside of single-quotes in the query, that makes it a string and strings are compared character by character starting with the left-most character.

    Oh thanks, got it the single quotes was causing a problem, thanks a lot

  2. SELECT pointtoIncrease FROM your_table WHERE amount BETWEEN amountFrom AND amountTo

     

    Thanks for the reply, i think query is not working. The query is

    SELECT pointtoIncrease FROM sa_mileagepoints WHERE '1000' BETWEEN amountFrom AND amountTo

     

    So, it should result 5 only, but the query is returning 3 rows, 1,5 and 0

     

    and if amount is 550, it returns two rows 3 and 0

     

  3. Hello,

     

    Suppose i have a table structure

     

    mID          pointtoIncrease              amountFrom            amountTo

    1                    0                                      0                            99

    2                    1                                      100                          499

    3                    3                                      500                          999

    4                    5                                      1000                        1499

     

    I have to select "pointoIncrease" for given amount. Like i have amount 550, then the point is 3 because 550 lies between amountFrom=500 and amountTo=999. Sounds simple but i m not being able to write a query for that, can anyone please help me.

     

    Thanks

     

  4.  

    Is it possible to have a field (int) to start with 2 zeros?

     

    eg,

     

    00123

     

    I have tried inputting the above value, but the sql table automatically rids them and inputs 123??

    datatype should be varchar for that. By the way you can prefix "00" in code, while you fetch data from the database

  5. Thanks again,

     

    The great tips, much appreciated. What i came up with is that,  we creates attributes for the subcategories, then create a new database table for that subcategory, say "tbl_apartments", and these attributes are saved in this table, simultaneously, we create two xmls for each subcategory, one will be used to create a search form and another to post new product form in the client side. I thought of creating xmls because, suppose there would be a combobox required which might have 100 of options, but we store just one selected value in the table "tbl_apartments" we created. But your idea of creating individual table for each sub-category is nice idea, the search would be pretty faster.

     

    Thanks

    Watsmyname

     

     

  6. Thanks a ton gizmola,

     

    I think creating individual table for each subcategories will be effective. Like first we create a table where we list all the subcategories and name of the tables related to those subcategories. And while creating sub-categories from back end, we'll have option to specify the attributes [properties]. Once done, we'll save the name of subcategory and the name of the new table to the indexing table. and we create a new table with attributes we mentioned from the back end. Am i right?

     

    But i m still confused how we create a search form or product posting form on client side depending upon the created sub category table?? Like for apartment we need Area [textbox], Number of Bedrooms [Combobox], Pets Allowed [Checkbox].. How we manage these form fields dynamically depending upon the sub categories??

     

    Thanks a lot

    Watsmyname

     

     

  7. Another question,  the suggestion i want.

     

    The project i m working is little more like ebay.com [but its not the ecommerce site, we will just have discussion and comparision of products], in a sense that we have hundreds of categories and subcategories, and for each subcategories we have different properties. For example for real estate we might have no. of bed rooms, garages etc. For car, we might have VIN number,  mileage, etc. Like each of the hundreds sub categories have different properties. And we have search form for items in each subcategories. Search form is different for each categories as we have different properties.  So creating search form manually for each subcategories is not possible.  So my plan is first from back end i add subcategory say "Apartments/Real Estates". After this we'll have a place where we can add properties like bedrooms, garages, kitchens, pets allowed or not etc. We'll add different properties as required for different sub-categories.

     

    Any suggestion or any comment whether i am  going right or not??

     

    Thanks

     

     

  8. thanks guys,

     

    well actually i am much concerned about search functionality in my site. I went through  craiglist and the search functionality is pretty fast. The search functionality in Facebook is too fast as well,  I guess they've used full text search functionality of mysql. Beside this are they using anything else to optimize search speed??

     

    Thanks

    watsmyname

  9. Thanks a lot Thorpe and fenway

     

    @Thorpe, well the informations are based on most user interaction, you can say its a custom forum where user discuss about a popular products in the market, the cost they paid it, the after sales service they got, etc, etc. Several millions of users will be discussing in the topic, they will also be comparing price of products from different states, cities, countries or even continents. In the same time several millions users may be just browsing the forum and see the discussion on the same time.

     

    @fenway

    How craiglist manage their database? do they have single database to maintain all the classifieds?? What technic they are using? can you please throw a light upon it?

    In my some project, mysql database used to crash when the table had several thousands of rows. So does performance of Mysql server depends upon the system specification??

     

    Thanks

    watsmyname

  10. Hello,

     

    I have a website which deals with products sales. The site has products listed on the basis of country, states and even cities. There would be estimated 50 million hits per month and same amount of mysql rows of products , details and reviews related to it per month. So, i m sure that if i maintain everything in single database my database will crash too often because of several million rows. So my thought is that i will make database based on countries. So for United States, there will be one database and everything related to US will be  put in this database, similarly for Canada, i will have another database, everything related to canada will be kept in this database...and so on. 

    I will appreciate the suggestion for this purpose. what should i do?

     

    Thanks

    watsmyname

  11. Hello,

     

    I want some suggestion on the report generator for PHP. I m working on project and i need to generate reports on CSV, XLS, HTML, and PDF

     

    CSV, XLS and HTML is not a problem but generating report on PDF format is what i need.

    I used  HTML2PDF [its a component of famous fpdf class] it can be used but, i have to show grid on report with some design and this html2pdf doesnt seem to generate report with proper designs like grid background, table width etc.

     

    Is there any php class which can generate a report in pdf without tampering the HTML designs?

     

    Thanks

    watsmyname

  12. Thanks mate

     

    My problem is that i have to work with database made by someone else long ago. The reason a field have comma separated value is because a song might have two artists, so in song table they've put the value in comma separated form.

     

    Next your mysql code works, but it adds extra comma like ,176,65,34,67. And next time when i search for 176, its position will be 2 not 1, isn't there another work around??

  13. Hey there

    I m sorry if its a repost, i tried to search with no results.

     

    I have mysql table and i have a field  which holds value something like sometimes 65, sometimes 65,34, sometimes 65,34,76 and so on. All i need is that i have to match certain value in these comma separated fields [finding i know, we use FIND_IN_SETS], but my problem is i have to find particular value and replace with another

     

    For instance, i have to search 76 and its found in 65,34,76. Now i have to replace this 76 with 67 to make our set look like 65,34,67.

     

    I hope my query is clear, can any body show me the way to achieve this with mysql?

     

    Thanks

  14. Is there any particular reason you have chosen to use php to create these dumps? MySql is quite capable of doing this alone.

    @thorpe

     

    you seem to be online, can you help me on this, i m not being able to get it work... I also noticed that blob content exported by phpmyadmin and my code are different. When i execute the insert statment generated by phpmyadmin, it works well with blob field binary/image data

  15. Thanks for the reply, i have backend control panel for the website. I dont have to backup whole database or even a whole table, my client just chooses a date and a ID, and rows matching his selection will be generated as SQL file with insert statement of each matching rows.

     

    Hope this makes you bit clear.

  16. Hello,

    well, my database has a table in which i have longblob field, where images and other files are saved in binary format. My necessity is to generate a .sql file that contains insert statement of the rows. I have used fopen and fputs function for that, but the problem is that when i  execute back the query from generated sql file, the longblob field contains plain text instead of Binary/image format. So please anybody help me with this!

     

    <?
    $bid_doc_sql2="SELECT * from tbl_bid_document WHERE tender_bid_id='1'";
    	$brs2=mysql_query($bid_doc_sql2) or die(mysql_error());
    	if(mysql_num_rows($brs2) > 0){
    
    		$openfile=fopen("data_backups/".$filename,"w");
    		while($row2=mysql_fetch_array($brs2))
    		{
    
    			$content .="insert into `tbl_bid_document_additional` (`tender_b_id`, `tender_bd_id`, `document_f`, `document_c`, `document_t`, `document_s`, `document_time`) values(`$row2[tender_b_id]`, `$row2[tender_bd_id]`, `$row2[document_f]`, `$row2[document_c]`, `$row2[document_t]`, `$row2[document_s]`, `$row2[document_time]`);\n";
    
    
    		}
    
    	}
    	fputs($openfile,$content);
    	fclose($openfile);
    
    // where document_c is the longblob field
    ?>
    
    

     

    Thanks

    watsmyname

  17. hello,

     

    well my server has limitation that i can run maximum upto 10 cron jobs. But i need to run  more than 10 files. Is there anyway to execute  PHP files without Cron jobs ??? may be using exec command?  or any other way beside requesting host to allow running more than 10 cron jobs??

     

    thanks

    watsmyname

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