Jump to content


  • Posts

  • Joined

  • Last visited


Posts posted by cmgmyr

  1. I'm making a "Hot or Not" site for one of my clients and I was just thinking about the rating system. How would the best way to handle a LOT of ratings and averages?


    Option 1:

    List everything in one big table. (id, userid, rating) then when a query is made it has to scan through all of this and get the average.


    Option 2:

    Use same table as above but add a "master" ratings table. (userid, total_rating, total_count) So that when I only have 1 row to query instead of 10,000+...


    The reason why I want to keep the one big table is to keep track of who voted and what they rated but I know if I just kept this one only eventually it will slow everything down. I'm kind of leaning toward option 2, but that means that I would have to do and insert/update twice.


    So...do you forsee any problems with using option 2? Do you have any other suggestions?




  2. mysql_connect("localhost", "username", "password") or die("Could not connect to mysql");
    mysql_select_db("database") or die("Could not connect to database");


    this allows you to connect to a database. You get your username and password when you set your mysql and database up.


    hope this helps you out

  3. I have a few clients that would like to easily import new data into their database...They download the current products in excel, make price changes, then upload the same excel file in the same format. Here is what I use:


    // mysql connection script ... 
    // tab delimited file 
    $file = "All_Catalog_Manufacturers.xls"; 
    // open file 
    $handle = fopen($file, "r"); 
    $x = 0;
    echo "<table border=1>";
    // loop through results with fgetcsv() function 
    while(($data = fgetcsv($handle, 1000, "\t")) !== FALSE) { 
        // populate field vars just to make it easier to work with ..  
        // you could access the $data[] array directly in the sql if you want 
        $field1 = $data[0]; 
        $field2 = $data[1]; 
        $field3 = $data[2]; 
        $field4 = $data[2]; 
        // etc ... 
        // build your sql statement 
        $sql = "insert into table set  
        //if($x >0) $result = mysql_query($sql); 
    if($x >0) echo "<tr><td>$field1</td><td>$field2</td><td>$field3</td></tr>";
    echo "</table>";
    // close file 


    ***I just have that outputting to a table, but you can just comment out the echo to the table and un-comment the mysql query.


    hope this helps

  4. If you are using php on a linux machine you can use the system function.




    Or if you are using Windows machines, you can use shell_exec function.






    $Info = explode("\n", shell_exec(".\\progs\\program.exe"));


    Will dump the output of program.exe in folder /progs/ to $Info using next line carriage as the exploder/seperator.



    *From: http://www.daniweb.com/techtalkforums/thread15662.html

  5. You might want to try one more thing...


    - plug a computer directly into the modem and make sure you can get to the internet.

    - View the network details settings (IP address, Default Gateway, etc...) and take a note of DNS 1, 2, and maybe 3.

    - Reconnect the router and the 2 PCs to the router.

    - See if they are picking up the DNS IPs. If they arent you are going to have to manually configure them to what you wrote down from above

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