sanjdhiman
Programmer
Hi there a simple question im sure for most of you guys.
Ok im running php 4 with apache and mySQL in the normal way
on win xp home
ok i have this problem i do the following insert statements when someone new registers. that is fine these all work . Thye are tried and tested.
function register ($emailadd, $pword, $fname, $lname, $number, $street, $county, $citytown, $postcode, $telno, $workno, $faxno)
// register a new person to the database
// return true if successful and false if not
{
$connection = db_connect();
if (!$connection)
return " Could not connect to database server, please try again";
// make sure user is not already entered in the database
$result = mysql_query("SELECT * FROM userlog WHERE username='$emailadd'"
;
if (!($result))
return "Could not execute query";
if (mysql_num_rows($result)>0)
return "That email address is taken, go back and choose another one. ";
// if all is well add user to database
//first add in the personal details first so that we can get the next new userID hence use that ID
//to match the userdetails to the userlogin details and the userattributes
$startdate=date("Y/m/d"
;
$endtimestamp = strtotime("+90 days"
;
$enddate=date('Y/m/d', $endtimestamp);
$result = mysql_query("INSERT into regusers (FirstName,
LastName,
HouseNumber,
StreetName,
CityTown,
County,
Postcode,
DateRegistered,
EndOfRegistration,
HTelephone,
WTelephone,
Fax,
Email,
FlaggedDeleted,
AccountStatus) VALUES ('$fname', '$lname', '$number', '$street', '$citytown', '$county', '$postcode', '$startdate', '$enddate', '$telno', '$workno', '$faxno', '$emailadd', '0', 'Live')"
;
$getuserid = mysql_query("SELECT UserID FROM regusers WHERE Email= '$emailadd'"
;
$row = mysql_fetch_array($getuserid);
$userid = stripslashes($row["UserID"]);
$result = mysql_query("INSERT into userlog (UserID,
UserName,
Password) VALUES ('$userid', '$emailadd', '$pword')"
;
$result = mysql_query("INSERT into userattr (UserID,
BgColour,
FgColour,
BorderColour,
FontSize,
FontFamily) VALUES('$userid', '0','0','0','0','0')"
;
Ok so they all work fine. Now just recently I created a new table in mySQL called userprofiles and i want to add info to this table as well when people register.
Ok so i set it up etc.. BUT i cant add to it. i even created a seperate page and nothing, it wont insert to mySQL to that particular table,
Below is the make up of the table, however i am when inside mysql able to INSERT into the table but when tryin it externally it wont let me.. I have checked the code over and over again but no errors can be seen?
CREATE TABLE userprofiles (
UserID int(5) unsigned zerofill NOT NULL DEFAULT '00000' ,
PropType varchar(20) NOT NULL DEFAULT '' ,
PriceMin int(6) unsigned ,
PriceMax int(7) unsigned ,
Bedrooms int(2) unsigned ,
Region varchar(20) NOT NULL DEFAULT '' ,
SaleToLet int(1) unsigned ,
PRIMARY KEY (UserID)
);
Is it mySQL problem or something different
$insert = mysql_query("INSERT into userprofiles (UserID,
PropType,
PriceMin,
PriceMax,
Bedrooms,
Region,
SaleToLet) VALUES ('2', 'flat', '10', '100','1','leicester','1')"
;
that is the insert statement but it dont work ????
its weird
thanks in advance
sanj
Ok im running php 4 with apache and mySQL in the normal way
on win xp home
ok i have this problem i do the following insert statements when someone new registers. that is fine these all work . Thye are tried and tested.
function register ($emailadd, $pword, $fname, $lname, $number, $street, $county, $citytown, $postcode, $telno, $workno, $faxno)
// register a new person to the database
// return true if successful and false if not
{
$connection = db_connect();
if (!$connection)
return " Could not connect to database server, please try again";
// make sure user is not already entered in the database
$result = mysql_query("SELECT * FROM userlog WHERE username='$emailadd'"
if (!($result))
return "Could not execute query";
if (mysql_num_rows($result)>0)
return "That email address is taken, go back and choose another one. ";
// if all is well add user to database
//first add in the personal details first so that we can get the next new userID hence use that ID
//to match the userdetails to the userlogin details and the userattributes
$startdate=date("Y/m/d"
$endtimestamp = strtotime("+90 days"
$enddate=date('Y/m/d', $endtimestamp);
$result = mysql_query("INSERT into regusers (FirstName,
LastName,
HouseNumber,
StreetName,
CityTown,
County,
Postcode,
DateRegistered,
EndOfRegistration,
HTelephone,
WTelephone,
Fax,
Email,
FlaggedDeleted,
AccountStatus) VALUES ('$fname', '$lname', '$number', '$street', '$citytown', '$county', '$postcode', '$startdate', '$enddate', '$telno', '$workno', '$faxno', '$emailadd', '0', 'Live')"
$getuserid = mysql_query("SELECT UserID FROM regusers WHERE Email= '$emailadd'"
$row = mysql_fetch_array($getuserid);
$userid = stripslashes($row["UserID"]);
$result = mysql_query("INSERT into userlog (UserID,
UserName,
Password) VALUES ('$userid', '$emailadd', '$pword')"
$result = mysql_query("INSERT into userattr (UserID,
BgColour,
FgColour,
BorderColour,
FontSize,
FontFamily) VALUES('$userid', '0','0','0','0','0')"
Ok so they all work fine. Now just recently I created a new table in mySQL called userprofiles and i want to add info to this table as well when people register.
Ok so i set it up etc.. BUT i cant add to it. i even created a seperate page and nothing, it wont insert to mySQL to that particular table,
Below is the make up of the table, however i am when inside mysql able to INSERT into the table but when tryin it externally it wont let me.. I have checked the code over and over again but no errors can be seen?
CREATE TABLE userprofiles (
UserID int(5) unsigned zerofill NOT NULL DEFAULT '00000' ,
PropType varchar(20) NOT NULL DEFAULT '' ,
PriceMin int(6) unsigned ,
PriceMax int(7) unsigned ,
Bedrooms int(2) unsigned ,
Region varchar(20) NOT NULL DEFAULT '' ,
SaleToLet int(1) unsigned ,
PRIMARY KEY (UserID)
);
Is it mySQL problem or something different
$insert = mysql_query("INSERT into userprofiles (UserID,
PropType,
PriceMin,
PriceMax,
Bedrooms,
Region,
SaleToLet) VALUES ('2', 'flat', '10', '100','1','leicester','1')"
that is the insert statement but it dont work ????
its weird
thanks in advance
sanj