<?php
$login=mysql_connect('localhost', 'wauhaha_karaoke', 'cross123','wauhaha_karaoke');
	
mysql_selectDB("wauhaha_karaoke",$login);

$query = mysql_query("SELECT CreID, CreNum FROM credittran ORDER BY CreNum DESC LIMIT 1");


$row = mysql_fetch_array($query);
$CreID = $row["CreID"];
list($one[0],$one[1]) = split('C',$CreID);

$index = ++$one[1];
$CreNum = $index;

if($index < 1000)
{
	$index = "C".$index;
}


echo "<input type='hidden' name='CreID' value='".$index."'><input type='hidden' name='CreNum' value='".$CreNum."'>".$index;
?>