Jump to content

Trying to create call logging system - need number generator


leachus2002

Recommended Posts

Hi All,

 

I am currently trying to create a web based call logging system, based on a PHP front end and a MSSQL back end. I want to be able to grab the next number in a sequence so that when calls are logged, they are given a reference number. I have throught about using the random number generator in PHP, but there is a slight chance that I will get the same number twice.

 

Is there a way that PHP can read, maybe from a table and use the next available number where a row is not populated?

 

Many Thanks

Matt

sorry to tell u but i cannot understand what u are asking..

 

if u want to check the rand number

 

<?php

for ($i=1;$i<=1000;$i++)
{
$arr = range('a','z');
$arr1=range('','');
shuffle($arr);
echo implode("", $arr);echo "<br>";
}
?>

 

the odds of getting the same value are astronomical in this one... :P

 

 

Hi, Apoligies for not making myself clear.

 

What I would like is for when a user is logging a call, then PHP assigns a call number to that call - for example 0001 - but when the next user logs a call, it assigns the next number, 0002 and so on and so on.

 

Does that make sense?

 

Thanks

Matt

Why not just let the (primary key) id field auto increment number serve as the reference number? Surely MS-Sql has a way to retrieve the id of the last inserted row similar to MySQL's mysql_insert_id.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.