I have this Code where i would insert a group of numbers from a database into the query for the message to be sent to, by selecting a group where it contains a group of numbers and the message will be sent to the whole list of numbers in that group what im trying to do is limit the numbers being inserted in to send by another input i provide to enter the number of message i want being sent any help is kindly appreciated
if(isset($_POST[sent]) and $_POST[gid] > 0){
$hh = 0;
$q = mysql_query( 'select * from numbers where sid = '.$_POST[gid].' and active = 1 and uid = ' . $_COOKIE['uid'] );
while ( $d = mysql_fetch_array( $q ) )
{
$phone = $tpl['user']['usergroup']['phone'];
$time =time();
$hhhh = "INSERT INTO `sending`
(`from`, `type`, `msg`, `to`, `uid`, `gid`, `msid`, `time`) VALUES
('$phone', '$_POST[type]', '$_POST[msg]', '$d[number]','$_COOKIE[uid]', '$_POST[gid]','$_POST[msid]', '$time')";
$ggg = mysql_query($hhhh);
//echo mysql_error();
$hh++;
}
$tpl['msg'] = "<div class='alert alert-succes' style='color:green'>