Jump to content

lookup and insert


user4fun

Recommended Posts

I am sure this little code can be reorganized to work better, matter of fact it is not raelly working right nowany help would be great

<html><head><title>Start Registration</title><style>a, a:visited, a:active {	text-decoration:none;}a:hover {	text-decoration:underline;}</style></head><?  $link = mysql_connect("", "", "") or die ("No connection");	mysql_select_db("business") or die ("no database");		 $q2 = mysql_query("SELECT `Website` FROM `Main` WHERE `Website` = '" . strtolower($_GET['Website']) ."' LIMIT 1");	   IF (mysql_num_rows($q2) == 1) :include ("file_in_sys.php");  die();ENDIF; $Con1 = $_GET['Con1'];$Con2 = $_GET['Con2'];$Website = $_GET['Website'];$Email = $_GET['Email'];$State = $_GET['State'];$City = $_GET['City'];$Today = date("m.d.y");    if ($Con1==123456 && $Con2==123) //will be reaplaced with variables later{$link = mysql_connect("", "", "") or die ("No connection");	mysql_select_db("business") or die ("no database"); 	$sql = "INSERT INTO confirmed (ConfirmID, Website, Email, State, City, Date)  VALUES ('', '$Website', '$Email', '$State', '$City', '$Today')";	 $query=mysql_query($sql);  	 if($query) 	 {		 echo "infromation in system";	 } 	 else						 	 {	 echo "failed to enter information"; 	 }}else{echo "con1 and 2 are wrong";}?></body></html>

Link to comment
Share on other sites

Use this for if thens: if (conditional) { // Code }You shouldn't try to start another connection unless you want to select another user (you would probably also end the other one) and selecting the same database. Assign values for server, username, and password in mysql_connect(). Make sure that you don't have ConfirmID field in your database as primary key because I don't think it allows for those types of values and can't have the same value.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...