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". 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()); ?> 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. Link to comment https://forums.phpfreaks.com/topic/226708-customer-number-generator/#findComment-1169960 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.