I posted this before the crash 🙂
I'm trying to pick random data from one table, and insert the result into another...but I'm coming back w/ an empty query..here is my code:
<?
require ('common.inc');
$db=mysql_connect("localhost","bla","");
mysql_select_db("blabla",$db);
$query1 = mysql_query("SELECT * FROM entries");
$numrows = mysql_num_rows($query1);
srand((double)microtime()*1000000);
$rnd = rand(0, $numrows - 1);
$result = mysql_query("SELECT * FROM entries LIMIT $rnd, 1", $db);
$result2=mysql_fetch_array($result);
$result_first_name = $result2["first_name"];
$result_last_name = $result2["last_name"];
$result_address = $result2["address"];
$result_city = $result2["city"];
$result_state = $result2["state"];
$result_zip = $result2["zip"];
$result_user_name = $result2["user_name"];
$result_pass_word = $result2["pass_word"];
$result_email = $result2["email"];
$query2 = mysql_query("INSERT INTO winners(first_name,last_name,address,city,state,zip,user_name,pass_word,email') VALUES ('$result2.result_first_name','$result2.result_last_name','$result2.result_address','$result2.result_city','$result2.result_state','$result2.result_zip','$result2.result_user_name','$result2.result_pass_word','$result2.result_email')");
//$query2 .= "VALUES ('$result_first_name','$result_last_name','$result_address','$result_city','$result_state','$result_zip','$result_user_name','$result_pass_word','$result_email');";
$mysql_result = mysql_query($query2,$db);
if (! $mysql_result) {
affy_error_exit("Error!");
}
?>
What am I doing wrong?