grlayouts Posted January 19, 2007 Share Posted January 19, 2007 ok if i have the codeCode:include("config.php");$result = mysql_query("select * from players WHERE id > 1 order by level desc limit 10");$result1 = mysql_query("select * from players");how would i get those 10 records to write into another table in my database called results?eg, round1, name, id, rank, score Link to comment https://forums.phpfreaks.com/topic/34877-write-from-php/ Share on other sites More sharing options...
paul2463 Posted January 19, 2007 Share Posted January 19, 2007 [code]<?php$result = mysql_query("select * from players WHERE id > 1 order by level desc limit 10");while($row = mysql_fetch_assoc($result)){ $var1 = $row['column1']; $var2 = $row['column2']; $var3 = $row['column3']; $query = "INSERT INTO results(column1, column2, column3) VALUES('$var1', '$var2', $var3')"; $res = myslq_query($query) or die ("Insert Failed". mysql_error()); }?>[/code] Link to comment https://forums.phpfreaks.com/topic/34877-write-from-php/#findComment-164388 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.