Jump to content

Recommended Posts

Helo. How do i insert letters on my unique id.

 

I mean i designed a form that a user fills to make a request. I want each request a user makes it should have its own unique transaction ID. and since i have more than just one form that needs be filled (on other pages there's form for other transactions), i want to adentify each form with a unique number exaple EN001 for a particular form and SE001 for another form etc.

 

I tried but dont know a way out of this. These my code:

 

CREATE TABLE `transactions` (

  `tranxID` int(255) NOT NULL auto_increment,

  `product_code` varchar(50) NOT NULL,

  `trans_type` varchar(50) NOT NULL,

  `pay_type` varchar(50) NOT NULL,

  `fname` varchar(50) NOT NULL,

  `lname` varchar(50) NOT NULL,

  `address` varchar(50) NOT NULL,

  `email` varchar(50) NOT NULL,

  `date_of_order` date NOT NULL,

  PRIMARY KEY  (`tranxID`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;

 

--

-- Dumping data for table `transactions`

--

 

INSERT INTO `transactions` (`tranxID`, `product_code`, `trans_type`, `pay_type`, `fname`, `lname`, `address`, `email`, `date_of_order`) VALUES

(1, '12345', 'single', 'cheque', 'chidi', 'obodo', '31 ladega', '[email protected]', '2008-07-18'),

Link to comment
https://forums.phpfreaks.com/topic/115538-generating-id/
Share on other sites

I use this in one of my games to create a Unique ID for each player when they register.

 

<?php
    $time = time();
    $uniqid = chr(rand(ord('a'),ord('z'))).chr(rand(ord('a'),ord('z'))).$time;
?>

 

and the output of that is this for example:

rm1215682605

 

Regards ACE

Link to comment
https://forums.phpfreaks.com/topic/115538-generating-id/#findComment-594002
Share on other sites

I use this in one of my games to create a Unique ID for each player when they register.

 

<?php
    $time = time();
    $uniqid = chr(rand(ord('a'),ord('z'))).chr(rand(ord('a'),ord('z'))).$time;
?>

 

and the output of that is this for example:

rm1215682605

 

Regards ACE

 

:o lots of code!

 

uniqid( ) ?

Link to comment
https://forums.phpfreaks.com/topic/115538-generating-id/#findComment-594025
Share on other sites

Helo. How do i insert letters on my unique id.

 

I mean i designed a form that a user fills to make a request. I want each request a user makes it should have its own unique transaction ID. and since i have more than just one form that needs be filled (on other pages there's form for other transactions), i want to adentify each form with a unique number exaple EN001 for a particular form and SE001 for another form etc.

 

I tried but dont know a way out of this. These my code:

 

CREATE TABLE `transactions` (

  `tranxID` int(255) NOT NULL auto_increment,

  `product_code` varchar(50) NOT NULL,

  `trans_type` varchar(50) NOT NULL,

  `pay_type` varchar(50) NOT NULL,

  `fname` varchar(50) NOT NULL,

  `lname` varchar(50) NOT NULL,

  `address` varchar(50) NOT NULL,

  `email` varchar(50) NOT NULL,

  `date_of_order` date NOT NULL,

  PRIMARY KEY  (`tranxID`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;

 

--

-- Dumping data for table `transactions`

--

 

INSERT INTO `transactions` (`tranxID`, `product_code`, `trans_type`, `pay_type`, `fname`, `lname`, `address`, `email`, `date_of_order`) VALUES

(1, '12345', 'single', 'cheque', 'chidi', 'obodo', '31 ladega', '[email protected]', '2008-07-18'),

 

Still cant get thing done. Anyone with any idea how it can get done cos am having head-ache trying to get it done. I want letter before the tranxID (i.e ES0012) thanks

Link to comment
https://forums.phpfreaks.com/topic/115538-generating-id/#findComment-598094
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.