hey guys. i'm new to php and am trying to write a script that checks a code the user inputs from one table and if that code matches code in that table, inputs username and password into another table. any help would be greatly appreciated. thanx in advance.
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());
?>