nicsnow Posted April 5, 2007 Share Posted April 5, 2007 Hi I need to add a prefix letter to sequential numbers that are autogenerated (a bit like creating invoice numbers) the guilty party is called accom_id this knocks out a 5 digit number which now needs to be displayed in the end result -either as a client page or data entry- as 'e12345' as opposed to '12345' - guidance please! Code below: <? if ($session=='kill'){ session_unregister(accom_id); unset($accom_id); } if (isset ($newclientid)){ $queryi = "UPDATE `accomm_main` SET `clientid` = '$newclientid' WHERE `accomm_id` = '$accom_id' "; //echo $queryi; $resulti=mysql_query($queryi,$conn); $clientid= $newclientid; } //really???? every bloody time??? if (!isset ($accom_id)){ dbconnect(); $query = "INSERT INTO `accomm_main` ( `accomm_id` , `status` , `resnumber` , `hotelid` , `clientid` , `usr` , `commision` , `rack_rate` , `saving` , `financial_arr` , `room_inclusion` , `booking_cond` , `special_terms` , `special_fin_terms` , `unit`, `type` ) VALUES ( NULL , '1', '', '0', '0', '$username', '0.00', '0.00', '0.00', '', '', '', '', '', '$userunit', '$flagtype' ) "; $result=mysql_query($query,$conn); session_register ('accom_id'); $accom_id=mysql_insert_id(); //echo $accom_id; } ?> <? Link to comment https://forums.phpfreaks.com/topic/45714-adding-a-prefix-to-an-autogenerated-number/ Share on other sites More sharing options...
opels Posted April 5, 2007 Share Posted April 5, 2007 not sure if this is what you need but change, //echo $accom_id; to echo "a".$accom_id; Link to comment https://forums.phpfreaks.com/topic/45714-adding-a-prefix-to-an-autogenerated-number/#findComment-222073 Share on other sites More sharing options...
nicsnow Posted April 5, 2007 Author Share Posted April 5, 2007 Cheers I'll give it a go and see if anything breaks! Link to comment https://forums.phpfreaks.com/topic/45714-adding-a-prefix-to-an-autogenerated-number/#findComment-222081 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.