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

$query = mysql_query("SELECT MemID, MemNum FROM regmember ORDER BY MemNum DESC LIMIT 1");
$row=mysql_fetch_array($query);


$MemID = $row["MemID"];
list($one[0],$one[1]) = split('M',$MemID);

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

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


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