Re: Hello
| From: | Karl DeSaulniers | Date: | Mon, 14 Dec 2009 04:28:55 +0000 |
| Subject: | Re: Hello | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-46688@lists.php.net to get a copy of this message | ||
HI,
Thanks for your response. Here is my query. UserID is auto incrament and UserLastLogin is a current_timestamp.
$query_users = "INSERT INTO users(UserID, Username, UserEmail, UserPassword, UserFirstName, UserLastName, UserCompany, UserAddress, UserAddress2, UserCity, UserState, UserCountry, UserZip, UserPhone, UserFax, UserEmailVerified, UserRegistrationDate, UserVerificationCode, UserIP, UserLastLogin)
VALUES('NULL','".$Username."','".$UserEmail."','".$UserPassword."','".$UserFirstName."','".$UserLastName."','".$UserCompany."','".$UserAddress."','".$UserAddress2."','".$UserCity."','".$UserState."','".$UserCountry."','".$UserZip."','".$UserPhone."','".$UserFax."','".$UserEmailVerified."','".$UserRegistrationDate."','".$UserVerificationCode."','".$UserIP."', now())";
This works as far as populating the database, but my results page does not return anything.
Only if the VALUES is set like this:
VALUES('NULL','".$Username=$_POST['Username']."','".$UserEmail=$_POST['UserEmail']."','".$UserPassword=$_POST['UserPassword']."','".$UserFirstName=$_POST['UserFirstName']."','".$UserLastName=$_POST['UserLastName']."','".$UserCompany=$_POST[$UserCompany]."','".$UserAddress=$_POST['UserAddress']."','".$UserAddress2=$_POST['UserAddress2']."','".$UserCity=$_POST['UserCity']."','".$UserState=$_POST['UserState']."','".$UserCountry=$_POST[$UserCountry]."','".$UserZip=$_POST['UserZip']."','".$UserPhone=$_POST['UserPhone']."','".$UserFax=$_POST[$UserFax]."','".$UserEmailVerified=$_POST[$UserEmailVerified]."','".$UserRegistrationDate=$_POST[$UserRegistrationDate]."','".$UserVerificationCode=$_POST['UserVerificationCode']."','".$UserIP=$_POST[$UserIP]."', now())";
but some do not work with this setup. variables like $UserEmailVerified, $UserRegistrationDate and $UserIP are not created from the form that was submitted.
for example, User IP date is created like this.
$UserIP = md5($_SERVER[REMOTE_ADDR]);
---------------------
Below is a snip of how I retrieve the info on the result page (dont want to clutter with whole code. also $fieldOne etc are MySql wildcards '%' from some dropdown lists that show before this code is executed. The results from adding show up fine there.)
$query_users = "SELECT * FROM users WHERE UserID LIKE '$fieldOne' AND Username LIKE '$fieldTwo' AND UserEmail LIKE '$fieldThree' AND UserPassword LIKE '$fieldFour' AND UserFirstName LIKE '$fieldFive' AND UserLastName LIKE '$fieldSix' AND UserCompany LIKE '$fieldSeven' AND UserAddress LIKE '$fieldEight' AND UserAddress2 LIKE '$fieldNine' AND UserCity LIKE '$fieldTen' AND UserState LIKE '$fieldEleven' AND UserCountry LIKE '$fieldTwelve' AND UserZip LIKE '$fieldThirteen' AND UserPhone LIKE '$fieldFourteen' AND UserFax LIKE '$fieldFifteen' AND UserEmailVerified LIKE '$fieldSixteen' AND UserRegistrationDate LIKE '$fieldSeventeen' AND UserVerificationCode LIKE '$fieldEighteen' AND UserIP LIKE '$fieldNineteen' AND UserLastLogin LIKE '$fieldTwenty' LIMIT $min, $max_results";
$result = mysql_query($query_users) or die(mysql_error());
for($i = 1; $i <= $num_sql; $i++) {
$r = mysql_fetch_array($result, MYSQL_ASSOC);
$UserID = $r['UserID'];
$Username = $r['Username'];
$UserEmail = $r['UserEmail'];
$UserPassword = $r['UserPassword'];
so I have 3 pages. one adds the users, the next reviews and the last shows the results of what is picked.
Thanks,
Karl