DoQtor N0 Posted February 4, 2011 Share Posted February 4, 2011 How can I do the following: 1. Upon successful login, generate a random 8-digit customer number and assign it to that customer and writes that data to mYsQl. 2. Screen then refreshes and reads, "Welcome Mr Smith". Quote Link to comment https://forums.phpfreaks.com/topic/226708-customer-number-generator/ Share on other sites More sharing options...
drisate Posted February 4, 2011 Share Posted February 4, 2011 You can create a random number like this <?php $rand = rand(10000000, 99999999); $INSERT = mysql_query("INSERT INTO $table (rand) VALUES ($rand) WHERE id='$_SESSION[id]'") or die(mysql_error()); ?> Quote Link to comment https://forums.phpfreaks.com/topic/226708-customer-number-generator/#findComment-1169959 Share on other sites More sharing options...
coupe-r Posted February 4, 2011 Share Posted February 4, 2011 You don't need to generate a random number. If they already have an "account" they have an ID. Simply set a $_SESSION['firstname'] = $row['firstname']; and echo the session var on your page. Quote Link to comment https://forums.phpfreaks.com/topic/226708-customer-number-generator/#findComment-1169960 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.