hi i am new in PHP ,i am doing my job in a company and there are some existing project they tell to me plz check and remove errors ,i m trying more and more to remove this error but i m failure....plz help me.

<?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>

Recommended Answers

All 15 Replies

Stupid question. Where is your connection to the database?

connection of database is right its in line first require_once("header.inc.php").
when i am searching something the result is fine but when i m going to next page then error show like that 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

connection of database is right its in line first require_once("header.inc.php").
when i am searching something the result is fine but when i m going to next page then error show like that 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

Well, thats because, the variable $result is empty or doesn't have a valid mysql resource. Try printing $result value. If it prints null(ie., if it doesn't print anything!), then you know where your problem is.
Btw, Next time you post your question, please put your code within [c o d e] [/ c o d e] tags.

Dear nav33n but where and how i print $result value plz suggest me.

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)
{

The parameter $result. Check where you are passing the parameter to this function. Also check $result value before calling the function.

plz edit in this page and send me i m not getting what u like to say...bcoz i m new in PHP

You are new to php and you have written a lengthy script ! Interesting ! anyway, I would suggest you to put the query in a variable, then pass the variable to mysql_query. Eg. $query="select * from members where $qw between '$dfrom' and '$dto' $q1 $q2 $q3 $q4 $q5 $q6 $q7"; and then, $result=mysql_query($query); instead of, $result=mysql_query("select * from members where $qw between '$dfrom' and '$dto' $q1 $q2 $q3 $q4 $q5 $q6 $q7"); Print $query variable. Execute the 'echoed' output in phpmyadmin. The bottomline is, echo the query, execute it in phpmyadmin, debug your error (cuz thats where the error is!)

this is not my coding so many confusion plz help me...after this error is like that on next page
select * from members where between '//' and '//' and mbranch=''
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

select * from members where between '//' and '//' and mbranch=''

The variable $qw isn't holding any value. Check out the value of $qw during the execution of this part.

(if($radio=='sreg') { $qw="mdate";}
if($radio=='sexpir') { $qw="mend";} )

Hi Nav33 its didnot cleared my problem yaaar plz help me,i m very hopeless regarding this?

Its as simple as you can see. Your variables aren't holding any value. So, the query is incomplete. select * from members where between '//' and '//' and mbranch='' . The best way you can solve your problem is by backtracking. Check why the value is empty, look for the part of the script where its assigning the value, check out why it isn't assigning any value. Its too difficult for us to debug your code when we have no idea what you actually want and what you are doing.

Please stop the madness!
Replace all of this

$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"];

with this extract($row); . Easier, no?

Simply put, it is telling you that, on line 31:
$row=mysql_fetch_array($result);
$result is not valid.

This is not guaranteed to work: if you pass $result to the 'next' page as a hidden value in the form, it might start working. But only if the database connection is maintained from one page invocation to another.

Otherwise, you may have to create a 'temporary' table to store the results. Then you would have to pass the record#+1 as a hidden value when you click 'Next'.

You seem to be overlooking the fact that PHP and web operations are not running from a single instance of a program. Rather, each new web page access results in a fresh instance of the program. Variable do not maintain their values. Database connections are probably not maintained either.

I've been doing LAMP (Linux, Apache, MySQL and PHP) for 5-6 years (been programming since DECsystem-10 days), and I *still* trip over this from time to time!

A potential solution might involve ensuring that each record of the query result has a unique ID. The first query returns the first record (by using 'ORDER BY id' and 'LIMIT 1' verbage in the query). The 'Next' button passes the ID to the server (via a hidden form element) and causes a new query to be performed that uses 'WHERE id>$cur_id', 'ORDER BY id', and 'LIMIT 1' verbage. A 'Previous' button would use 'WHERE id<$cur_id', 'ORDER BY id', 'DESCENDING' and 'LIMIT 1' verbage.

In summary, you MUST pass a certain amount of 'current state' information to the next invocation of the web page. If you don't, the new invocation won't have a clue as to what you are doing.

Add error_reporting(0) in top of the page

error messages are not listed in front end

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.