Re: temp tables mysql OT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Dec 13, 2007 10:37 AM, Daniel Brown <parasane@xxxxxxxxx> wrote:
> <?
> // Put DB and config includes here.
>
> $sql = "SELECT * FROM prod_table WHERE product_name != '' ORDER BY product_id";
> $result = mysql_query($sql) or die(mysql_error());
> while($row = mysql_fetch_array($result)) {
>     $ssql  = "INSERT INTO tmp_table(product_id,product_name,val,val2) ";
>     $ssql .= "VALUES('".$row['product_id']."','".$row['product_name']."','$row['val']."','".$row['val2']."')";
>     mysql_query($ssql);
> }
>
> mysql_query("DROP TABLE prod_table");
> mysql_query("RENAME TABLE tmp_table TO prod_table") or die(mysql_error());
> ?>

    There are much prettier, cleaner, more efficient ways of doing it,
I'm sure, but if you're banging your head off the wall just vying for
a simple solution, MySQL can handle the ~5,001 queries without issue.
;-)

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux