hi Kaushik,
thanx, for your help, it really worked that way, thanx again.
but now the porblem is the value is not getting updated. below given is the code which i have wrote, have look at it and tell me wats wrong with it :
<?php
//### Connecting to database ###
include ( "include/conectdb.inc" );
// ## Check for uniqueness of Username(USER) ##
$sql = "SELECT username FROM user WHERE username = '$uname'";
$sql_result = mysql_query($sql,$db);
print mysql_error();
$numrows = mysql_num_rows($sql_result);
if ($numrows==0)
{
// ## Process IP, Date, ID ##
$ipadd = getenv("REMOTE_ADDR");
timestamp function :-
$dtstamp = time();
$date_array = getdate($dtstamp);
$mnth = $date_array["mon"];
$day = $date_array["mday"];
$yr = $date__array["year"];
$dor = "$day/$mnth/$yr";
$visits = 1;
// # Get ID #
$sql1 = "SELECT max(substring(userid,2,9)) FROM user";
$result1 = mysql_query($sql1,$db);
print mysql_error();
$nxtnum = $result1;
echo $nxtnum;
if($nxtnum==0)
$id="u000000001";
$nxtnum = $nxtnum+1;
echo $nxtnum;
if(($nxtnum>=1) AND ($nxtnum<10))
$id="u00000000".$nxtnum;
else
if(($nxtnum>=10) AND ($nxtnum<100))
$id="u0000000".$nxtnum;
else
if(($nxtnum>=100) AND ($nxtnum<1000))
$id="u000000".$nxtnum;
else
if(($nxtnum>=1000) AND ($nxtnum<10000))
$id="u00000".$nxtnum;
else
if(($nxtnum>=10000) AND ($nxtnum<100000))
$id="u0000".$nxtnum;
else
if(($nxtnum>=100000) AND ($nxtnum<100000))
$id="u000".$nxtnum;
else
if(($nxtnum>=1000000) AND ($nxtnum<1000000))
$id="u00".$nxtnum;
else
if(($nxtnum>=10000000) AND ($nxtnum<10000000))
$id="u0".$nxtnum;
else
if(($nxtnum>=100000000) AND ($nxtnum<100000000))
$id="u".$nxtnum;
// ## Insert Data into Database(USER) ##
$sql = "INSERT INTO user(userid, username, password, income, dob, visits) VALUES ('$id', '$uname', '$pw1', '$income', '$dd/$mm/$yy', '$visits')";
$sql_result = mysql_query($sql, $db);// or die("Error executing Query");
print mysql_error();
// ## Insert Data into Database(ADDRESS) ##
$sql = "INSERT INTO address (adid, name, address, city, state, pin, phone1, phone2, country, email, dor, ipadd) VALUE('$id', '$name', '$address', '$city', '$state', '$pin', '$phone1', '$phone2', '$country', '$email', '$dor', '$ipadd')";
$sql_result = mysql_query($sql, $db);
print mysql_error();
// ### Close Connection ###
include ( "include/closedb.inc" );
?>