hey.
i have a prob with log in. when d user logs in, i want to check code they enter in one table and if the code matches code in the table, insert username and password into another table. can anyone help? its probs really simple but i'm new to php
Code:
<?PHP
$connection=mysql_connect("localhost","","")
or die('Could not connect to the database server');
$db = mysql_select_db("test", $connection)
or die ("Unable to select database.");
//do i use a while or an if statement here or wot
$sql="SELECT * FROM codes WHERE code='$code'";
$result = mysql_query($sql, $db);
`
$sql1 = "INSERT INTO voter (username, password, conid)
VALUES ('$username', password('$password'), '$conid')";
$sql_result = mysql_query($sql1, $connection) or die (mysql_error());
?>
all help greatly appreciated. thank you in advance, also does anyone know a really simple voting/poll script. anyones i have found, i can't understand