User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 402,064 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,478 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 378 | Replies: 0
Reply
Join Date: Dec 2007
Posts: 9
Reputation: tariq04 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
tariq04 tariq04 is offline Offline
Newbie Poster

Help paging related

  #1  
Dec 23rd, 2007
<?php require("header.inc.php");
/*session_start();
if(($useradmin)=='')
{
header( "Location: error.php" );
} */?>
<html>
<head>
<link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="colors.css">
<title>Admin Area : Users</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<SCRIPT language=javaScript type="text/javascript">
function D(url)
{
window.open(url,"data","width=550,height=600,scrollbars=no,resizable=no");
}

</SCRIPT>
</head>
<body>
<?
//This variable is for date
$dfrom="$year/$month/$day";
$dto="$year1/$month1/$day1";

function getnextt($result,$qwery){
global $uid,$msex,$mgsm,$memail,$mstep,$mname,$medu,$mcheq,$msale,$amm,$mtitle,$mfirst,$mmiddle,$mlast,$mtype,$tott,$mlogin,$mrefer,$mcountry,$mbranch,$mnation,$mnation2,$mdate,$mend,$mphone,$midno,$midnodate,$midplace,$mbirtharabic,$mbirthplace,$mbirth,$mmarital,$domain,$domainx;
if(!$qwery){
$row=mysql_fetch_array($result);

if($row)
{
$mnation2=$row["mnation2"];
$midnodate=$row["midnodate"];
$midplace=$row["midplace"];
$midno=$row["midno"];
$mbirtharabic=$row["mbirtharabic"];
$mbirthplace=$row["mbirthplace"];
$mbirth=$row["mbirth"];
$mcheq=$row["mcheq"];
$medu=$row["medu"];
$mname=$row["mname"];
$mstep=$row["mstep"];
$mmarital=$row["mmarital"];
$msex=$row["msex"];
$mgsm=$row["mgsm"];
$uid=$row["uid"];
$msale=$row["msale"];
$mtype=$row["mtype"];
$amm=$row["amm"];
$tott=$row["tott"];
$mlogin=$row["mlogin"];
$mtitle=$row["mtitle"];
$mfirst=$row["mfirst"];
$mmiddle=$row["mmiddle"];
$mlast=$row["mlast"];
$mrefer=$row["mrefer"];
$memail=$row["memail"];
$mphone=$row["mphone"];
$mstreet=$row["mstreet"];
$mcity=$row["mcity"];
$mcountry=$row["mcountry"];
$mnation=$row["mnation"];
$mbranch=$row["mbranch"];
$mdate=$row["mdate"];
$mend=$row["mend"];
$mbank=$row["mbank"];
$mip=$row["mip"];
$domain=$row["domain"];
$domainx=$row["domainx"];
}
return $row;

}
$qw=quotemeta($qwery);

while($row=mysql_fetch_array($result))
{
if(preg_match("/$qw/i",$row["mlogin"])||preg_match("/$qw/i",$row["mfirst"])||preg_match("/$qw/i",$row["memail"])||preg_match("/$qw/i",$row["mcountry"])||preg_match("/$qw/i",$row["mcity"])||preg_match("/$qw/i",$row["mstreet"])||preg_match("/$qw/i",$row["mbank"])||preg_match("/$qw/i",$row["mip"])||preg_match("/$qw/i",$row["mdate"])||preg_match("/$qw/i",$row["mname"])||preg_match("/$qw/i",$row["mstep"])||preg_match("/$qw/i",$row["msale"])||preg_match("/$qw/i",$row["msex"])||preg_match("/$qw/i",$row["mgsm"])||preg_match("/$qw/i",$row["medu"])||preg_match("/$qw/i",$row["mcheq"]) )break;
}
if($row)
{
$mnation2=$row["mnation2"];
$midnodate=$row["midnodate"];
$midplace=$row["midplace"];
$mbirtharabic=$row["mbirtharabic"];
$mbirthplace=$row["mbirthplace"];
$mcheq=$row["mcheq"];
$medu=$row["medu"];
$mname=$row["mname"];
$mstep=$row["mstep"];
$mmarital=$row["mmarital"];
$msex=$row["msex"];
$mgsm=$row["mgsm"];
$uid=$row["uid"];
$msale=$row["msale"];
$mtype=$row["mtype"];
$amm=$row["amm"];
$tott=$row["tott"];
$mlogin=$row["mlogin"];
$mtitle=$row["mtitle"];
$mfirst=$row["mfirst"];
$mmiddle=$row["mmiddle"];
$mlast=$row["mlast"];
$mrefer=$row["mrefer"];
$memail=$row["memail"];
$mphone=$row["mphone"];
$mstreet=$row["mstreet"];
$mcity=$row["mcity"];
$mcountry=$row["mcountry"];
$mnation=$row["mnation"];
$mbranch=$row["mbranch"];
$mdate=$row["mdate"];
$mend=$row["mend"];
$mbank=$row["mbank"];
$mip=$row["mip"];
$domain=$row["domain"];
$domainx=$row["domainx"];
$mbirth=$row["mbirth"];

}
return $row;
}

?>
<br>
<?

$sno=1;
?>

<a href="javascript:history.go(-1)">Back</a>

<? echo "<center><strong>Data of Registration/ Expiration</strong></center>" ; ?>



<? if($ac=="search"){ ?>
<? if ($pcert!=NULL) { ?>
<form action="certificatedown.php" method="post">
<div align="right">
<input name="Submit" type="submit" class="markx" value="For Certificate">
<br>
<br>
</div>
<? } else { ?>

<form action="search_mail.php" method="post">
<div align="right">
<input name="Submit2" type="submit" class="markx" value="Mail" >
<br>
<br>
</div>
<? } ?>


<table width="100%" bgcolor="#00CCCC" cellspacing="0" cellpadding="0" border="1">
<tr>
<td>
<table width="100%" bgcolor="#00CCCC"height="90" border="1" cellpadding="0"cellspacing="1" >
<tr bgcolor="#CC3333" >
<td class="txt3" style3><div align="center"><strong>SerialNo</strong></div></td>
<? if ($user!=NULL) echo "<td class=txt3 style3><div align=center><strong>UserID</strong></div></td> ";?>
<? if ($ufirst!=NULL) echo "<td class=txt3 style3><div align=center><strong>UserName</strong></div></td> ";?>
<? if ($certname!=NULL) echo "<td class=txt3 style3><div align=center><strong>CertificateName</strong></div></td> ";?>
<? if ($umobile!=NULL) echo " <td class=txt3 style3><div align=center><strong>UserMobile</strong></div></td> "; ?>
<? if ($uphone!=NULL) echo " <td class=txt3 style3><div align=center><strong>UserPhone</strong></div></td> "; ?>
<? if ($refer!=NULL) echo " <td class=txt3 style3><div align=center><strong>Refer</strong></div></td> "; ?>
<? if ($rfirst!=NULL) echo " <td class=txt3 style3><div align=center><strong>ReferName</strong></div></td> "; ?>
<? if ($rmobile!=NULL) echo " <td class=txt3 style3><div align=center><strong>ReferMobile</strong></div></td> "; ?>
<? if ($rphone!=NULL) echo " <td class=txt3 style3><div align=center><strong>ReferPhone</strong></div></td> "; ?>
<? if ($cr!=NULL) echo " <td class=txt3 style3><div align=center><strong>Type</strong></div></td> "; ?>
<? if ($mf!=NULL) echo " <td class=txt3 style3><div align=center><strong>Sex</strong></div></td> "; ?>
<? if ($nat!=NULL) echo " <td class=txt3 style3><div align=center><strong>Nationality</strong></div></td> "; ?>
<? if ($regdate!=NULL) echo " <td class=txt3 style3><div align=center><strong>Registration</strong></div></td> "; ?>
<? if ($expdate!=NULL) echo " <td class=txt3 style3><div align=center><strong>Expiry</strong></div></td> "; ?>
<? if ($ammount!=NULL) echo " <td class=txt3 style3><div align=center><strong>Amount</strong></div></td> "; ?>
<? if ($dom!=NULL) echo " <td class=txt3 style3><div align=center><strong>Domain</strong></div></td> "; ?>
<? if ($doba!=NULL) echo " <td class=txt3 style3><div align=center><strong>Dateofbirth</strong></div></td> "; ?>
<? if ($pob!=NULL) echo " <td class=txt3 style3><div align=center><strong>Placeofbirth</strong></div></td> "; ?>
<? if ($idnum!=NULL) echo " <td class=txt3 style3><div align=center><strong>IDNumber</strong></div></td> "; ?>
<? if ($iddate!=NULL) echo " <td class=txt3 style3><div align=center><strong>IDDate</strong></div></td> "; ?>
<? if ($idplace!=NULL) echo " <td class=txt3 style3><div align=center><strong>IDPlace</strong></div></td> "; ?>
<? if ($lcheque!=NULL) echo " <td class=txt3 style3><div align=center><strong>Lastcheque</strong></div></td> "; ?>
<? if ($lcdate!=NULL) echo " <td class=txt3 style3><div align=center><strong>LastDate</strong></div></td> "; ?>
<? if ($nmchek!=NULL) echo " <td class=txt3 style3><div align=center><strong>Namecheque</strong></div></td> "; ?>
<? if ($nlchek!=NULL) echo " <td class=txt3 style3><div align=center><strong>NumberCheque</strong></div></td> "; ?>
<? if ($center!=NULL) echo " <td class=txt3 style3><div align=center><strong>Branch</strong></div></td> "; ?>
<? if ($tstep!=NULL) echo " <td class=txt3 style3><div align=center><strong>Step</strong></div></td> "; ?>
<? if ($dc!=NULL) echo " <td class=txt3 style3><div align=center><strong>D-C</strong></div></td> "; ?>
<? if ($uemail!=NULL) echo "<td class=txt3 style3><div align=center><strong>Email</strong></div></td>"; ?>
<? if ($sig!=NULL){
for ($s=0; $s<$signum; $s++) { //This is increasing the signature column
echo " <td class=txt3 style3><div align=center><strong>Signature</strong></div></td> "; } } ?>


<?

if($strt=="") $strt=0;

if($radio=='sreg') { $qw="mdate";}
if($radio=='sexpir') { $qw="mend";}
if($member=='cu') { $q1="and mtype='cu'"; }
if($member=='re') { $q1="and mtype='re'"; }
if($sex2=='male') { $q2="and msex='male'"; }
if($sex2=='female') { $q2="and msex='female'"; }
if ($center_name=='all') {$q3="";}
else { $q3="and mbranch='$center_name'";}
if($step!=NULL) { $q4= "and mstep>='$step'"; }
if($step2!=NULL) { $q5= "and mstep<='$step2'"; }
if($direct!=NULL) { $q6= "and msale>='$direct'"; }
if($direct2!=NULL) { $q7= "and msale<='$direct2'"; }
$result=mysql_query("select * from members where $qw between '$dfrom' and '$dto' $q1 $q2 $q3 $q4 $q5 $q6 $q7");

for($x=0;$x<$strt;$x++) getnextt($result,$search);
$x=0;

while($x++<$rpage&&getnextt($result,$search))
{

$result1=mysql_query("SELECT * FROM members where mlogin='$mrefer'");
$rows1 = @mysql_num_rows($result1);
while ($row = mysql_fetch_array($result1))
{
$rfirst1=$row["mfirst"];
$rfirst2=$row["mlast"];
$rmobile1=$row["mgsm"];
$rphone1=$row["mphone"];
}
$result12 = mysql_query("select * from checks where user='$mlogin' and cdeliver=1");
$rows12 = @mysql_num_rows($result12);
while ($row = mysql_fetch_array($result12))
{
$ldate=$row["ddeliver"];
$lamm=$row["amm"];
$numcheq=$row["cheqno"];
}

?>
</tr>
<tr bgcolor="#00CCCC" >

<td class="txt3" style3><div align="center"><? echo $sno;$sno++;?></div></td>
<? if ($user!=NULL) echo "<td class='txt3'><div align='center'> $mlogin </div></td>" ; ?>
<? if ($ufirst!=NULL) echo "<td class='txt3'><div align='center'> $mfirst $mlast &nbsp;</div></td>"; ?>
<? if ($certname!=NULL) echo "<td class='txt3'><div align='center'> $mname &nbsp;</div></td>" ; ?>
<? if ($umobile!=NULL) echo "<td class='txt3'><div align='center'> $mgsm &nbsp;</div></td>" ; ?>
<? if ($uphone!=NULL) echo "<td class='txt3'><div align='center'> $mphone &nbsp;</div></td>" ; ?>
<? if ($refer!=NULL) echo "<td class='txt3'><div align='center'> $mrefer &nbsp;</div></td>" ; ?>
<? if ($rfirst!=NULL) echo "<td class='txt3'><div align='center'> $rfirst1 $rfirst2 &nbsp;</div></td>" ; ?>
<? if ($rmobile!=NULL) echo "<td class='txt3'><div align='center'> $rmobile1 &nbsp;</div></td>" ; ?>
<? if ($rphone!=NULL) echo "<td class='txt3'><div align='center'> $rphone1 &nbsp;</div></td>" ; ?>
<? if ($cr!=NULL) echo "<td class='txt3'><div align='center'> $mtype &nbsp; </div></td>" ; ?>
<? if ($mf!=NULL) echo "<td class='txt3'><div align='center'> $msex &nbsp; </div></td>" ; ?>
<? if ($nat!=NULL) echo "<td class='txt3'><div align='center'> $mnation2 &nbsp;</div></td>" ; ?>
<? if ($regdate!=NULL) echo "<td class='txt3'><div align='center'> $mdate &nbsp;</div></td>" ; ?>
<? if ($expdate!=NULL) echo "<td class='txt3'><div align='center'> $mend &nbsp;</div></td>" ; ?>
<? if ($ammount!=NULL) echo "<td class='txt3'><div align='center'> $amm &nbsp;</div></td>" ; ?>
<? if ($dom!=NULL) echo "<td class='txt3'><div align='center'> $domain.$domainx </div></td>" ; ?>
<? if ($doba!=NULL) echo "<td class='txt3'><div align='center'> $mbirtharabic &nbsp;</div></td>" ; ?>
<? if ($pob!=NULL) echo "<td class='txt3'><div align='center'> $mbirthplace &nbsp;</div></td>" ; ?>
<? if ($idnum!=NULL) echo "<td class='txt3'><div align='center'> $midno &nbsp;</div></td>" ; ?>
<? if ($iddate!=NULL) echo "<td class='txt3'><div align='center'> $midnodate &nbsp;</div></td>" ; ?>
<? if ($idplace!=NULL) echo "<td class='txt3'><div align='center'> $midplace &nbsp;</div></td>" ; ?>
<? if ($lcheque!=NULL) echo "<td class='txt3'><div align='center'> $lamm &nbsp;</div></td>" ; ?>
<? if ($lcdate!=NULL) echo "<td class='txt3'><div align='center'> $ldate &nbsp;</div></td>" ; ?>
<? if ($nmchek!=NULL) echo "<td class='txt3'><div align='center'> $mcheq &nbsp;</div></td>" ; ?>
<? if ($nlchek!=NULL) echo "<td class='txt3'><div align='center'> $numcheq &nbsp;</div></td>" ; ?>
<? if ($center!=NULL) echo "<td class='txt3'><div align='center'> $mbranch &nbsp;</div></td>" ; ?>
<? if ($tstep!=NULL) echo "<td class='txt3'><div align='center'> $mstep &nbsp;</div></td>" ; ?>
<? if ($dc!=NULL) echo "<td class='txt3'><div align='center'> $msale &nbsp;</div></td>" ; ?>
<? if ($uemail!=NULL) echo "<td class='txt3'><div align='center'> $memail &nbsp;</div></td>" ; ?>

<? if ($sig!=NULL) {
for ($s=0; $s<$signum; $s++) {
echo "<td class='txt3'><div align='center'> &nbsp;</div></td>" ; } }


/******************* Data Array for Certificates ***********************/
$a[]=$mname;
$b[]=$mnation2;
$c[]=$midno;
$d[]=$midnodate;


//This is for statistics
if ($mtype=='cu') { $cno=$cno+1; }
if ($mtype=='re') { $rno=$rno+1; }
if ($msex=='male') { $mno=$mno+1; }
if ($msex=='female') { $fno=$fno+1; }
if ($mmarital=='single') { $singno=$singno+1; }
if ($mmarital=='married') { $marno=$marno+1; }
if ($medu=='10th') { $tenth=$tenth+1; }
if ($medu=='12th') { $twth=$twth+1; }
if ($medu=='Bachelor') { $bache=$bache+1; }
if ($medu=='Master') { $mast=$mast+1; }
if ($medu=='Phd') { $phd=$phd+1; }
if ($medu=='') { $non=$non+1; }
$tyear= date ("Y-m-d");
$datediff= $tyear - $mbirth ;
if ($datediff >50) { $a50=$a50+1; }
if (($datediff >40)and ($datediff <=50)){ $a40=$a40+1; }
if (($datediff >35)and ($datediff <=40)){ $a35=$a35+1; }
if (($datediff >30)and ($datediff <=35)){ $a30=$a30+1; }
if (($datediff >25)and ($datediff <=30)){ $a25=$a25+1; }
if (($datediff >20)and ($datediff <=25)){ $a20=$a20+1; }
if ($datediff <=20) { $b20=$b20+1; }



//this is for clearing the chache value
$ldate=NULL;
$lamm=NULL;
$numcheq=NULL;
}

for($i=0;$i<$sno;$i++)
{
echo"<input type='hidden' name='aa[]' value='$a[$i]'>";
echo"<input type='hidden' name='bb[]' value='$b[$i]'>";
echo"<input type='hidden' name='cc[]' value='$c[$i]'>";
echo"<input type='hidden' name='dd[]' value='$d[$i]'>";

}


?>
</table></td>
</tr></table>
<input name="serial" type="hidden" id="serial" value="<? echo $sno-1?>">
</form>
<br>

<table bgcolor="#B8CEF0"width="100%">
<tr>
<td align="left">
<?
if($strt>0){

$sstr=$strt-$rpage;

print "<a href='search_adv1.php?ac=search&strt=$sstr&search=".urlencode($search)."'>Prev";
}
?>
</td>
<td align="right">
<?
if(getnextt($result,$search)){
$sstr=$strt+$rpage;

print "<a href='search_adv1.php?ac=search&strt=$sstr&search=".urlencode($search)."'>Next";
}
}
?>

</td></tr></table>

<p><a href="javascript:history.go(-1)">Back</a></p>
<table width="600" border="1" align="center">
<? if ($stype!=NULL) { ?>
<tr>
<td width="23%"><div align="right"><strong>Member Type </strong></div></td>
<td width="22%"><div align="right">Customers :</div></td>
<td width="10%"><? echo $cno; ?>&nbsp;</td>
<td colspan="2"><div align="right">Representative : </div></td>
<td width="9%"><? echo $rno; ?></td>
</tr>
<? } ?>
<? if ($ssex!=NULL) { ?>
<tr>
<td><div align="right"><strong>Sex</strong></div></td>
<td><div align="right">Male : </div></td>
<td><? echo $mno; ?>&nbsp;</td>
<td colspan="2"><div align="right">Female : </div></td>
<td><? echo $fno; ?>&nbsp;</td>
</tr>
<? } ?>
<? if ($smstatus!=NULL) { ?>
<tr>
<td><div align="right"><strong>Maritial Statues </strong></div></td>
<td><div align="right">Single : </div></td>
<td><? echo $singno; ?>&nbsp;</td>
<td colspan="2"><div align="right">Married : </div></td>
<td><? echo $marno; ?></td>
</tr>
<? } ?>
<? if ($sedu!=NULL) { ?>
<tr>
<td><div align="right"><strong>Education </strong></div></td>
<td><div align="right">None :</div></td>
<td><? echo $non; ?>&nbsp;</td>
<td width="23%"><div align="right">10th : </div></td>
<td width="13%"><? echo $tenth; ?></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><div align="right">12th : </div></td>
<td><? echo $twth; ?></td>
<td><div align="right">Graduate : </div></td>
<td><? echo $bache; ?></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><div align="right">Post Graduate : </div></td>
<td><? echo $mast; ?>&nbsp;</td>
<td><div align="right">PhD/ Doctors : </div></td>
<td><? echo $phd; ?></td>
<td>&nbsp;</td>
</tr>
<? } ?>
<? if ($sage!=NULL) { ?>
<tr>
<td><div align="right"><strong>Age :</strong> </div></td>
<td><div align="right">Below 20 : </div></td>
<td><? echo $b20; ?>&nbsp;</td>
<td><div align="right">20 - 25 : </div></td>
<td><? echo $a20; ?>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><div align="right">25 - 30 : </div></td>
<td><? echo $a25; ?>&nbsp;</td>
<td><div align="right">30 - 35 : </div></td>
<td><? echo $a30; ?>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><div align="right">35 - 40 : </div></td>
<td><? echo $a35; ?>&nbsp;</td>
<td><div align="right">40 - 50 : </div></td>
<td><? echo $a40; ?>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><div align="right">Above 50 : </div></td>
<td><? echo $a50; ?>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<? } ?>
</table>

</body>
</html>
When i am going to next page of search there are such type of error.......
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\aaa\public\topok\search_adv1.php on line 31
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 12:36 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC