Hi Weedpacket, I was hoping you were around π
I worked on this yesterday and here's my first (and incomplete attempt)
<?php
//Connect To Database
$hostname='localhost;
$username='myname';
$password='mypassword';
$dbname='mydb';
$usertable='registration';
$yourfield = 'accountcode';
mysql_connect($hostname,$username, $password) OR DIE ('Unable to connect to database! Please try again later.');
mysql_select_db($dbname);
$userEntry = "optec12";
$query = "SELECT accountcode, idcode, visited FROM registration
WHERE accountcode = 'optec12'";
$result = mysql_query($query)
or die ("Couldn't execute query.");
$row = mysql_fetch_array($result, MYSQL_ASSOC);
extract($row);
if ($userEntry != $accountcode)//checks to see if account code is in db
{
echo "option 1 Sorry, that acountnumber is not found. $accountcode";
}
//accountcode is good, visited is YES, returns error
elseif ($userEntry == $accountcode and $visited !="NO")
{
echo "option 2: Sorry, your number is taken. $accountcode, $idcode, $visited";
}
//the accountcode is valid, visited is NO so they need to go to a page for "1" designated people.
elseif ($userEntry == $accountcode and $visited=="NO" and $idcode =="1")
{
echo "option 3: You will now be taken to page 1. $accountcode, $idcode, $visited";
// will need to UPDATE $visited from NO to Yes and redirect them to a different page based upon the idcode of "1"
}
//the accountcode is valid, visited is NO and they need to go to a page for "2" designated people
elseif ($userEntry == $accountcode and $visited=="NO" and $idcode =="2")
{
echo "option 4: Since your idcode is 2, you will now be taken to page 2. $accountcode, $idcode, $visited";
// will need to UPDATE $visited from NO to Yes and redirect them to a different page based upon the idcode of "2"
}
?>
I added the "$accountcode, $idcode, $visited" at the end of each reply so I can see which one I'm testing.
no, UPDATE doesnt need to be any particular form, just a way to tell if anyone has hit that number before.
this doesn't look very clean compared to yours, but I'm so new to this I was trying to write it so I can still understand it I guess.
thanks for any suggestions, Kathy