sankarkarthikeyan Posted September 2, 2011 Share Posted September 2, 2011 Can you help me with where im going wrong here in this code this with a search function i am see the out put with pagination view however $id is not getting captured as the link id any help would be appreciated <form name="frmSearch" method="get" action="<?=$_SERVER['SCRIPT_NAME'];?>"> <table id="tic"> <tr> <td>Ticket No | Emp ID:</td><td><input name="txtKeyword" type="text" id="txtKeyword" value="<?=$_GET["txtKeyword"];?>"></td> <td><input type="submit" name="submit" value="Search"></td> </tr> </table> </form> <? if($_GET["txtKeyword"] != "") { $objConnect = mysql_connect("localhost","root","") or die(mysql_error()); $objDB = mysql_select_db("ticket"); $result = "SELECT * FROM data WHERE (employee LIKE '%".$_GET["txtKeyword"]."%')"; $objQuery = mysql_query($result) or die ("Error Query [".$result."]"); $Num_Rows = mysql_num_rows($objQuery); $Per_Page = 5; // Per Page $Page = $_GET["Page"]; if(!$_GET["Page"]) { $Page=1; } $Prev_Page = $Page-1; $Next_Page = $Page+1; $Page_Start = (($Per_Page*$Page)-$Per_Page); if($Num_Rows<=$Per_Page) { $Num_Pages =1; } else if(($Num_Rows % $Per_Page)==0) { $Num_Pages =($Num_Rows/$Per_Page) ; } else { $Num_Pages =($Num_Rows/$Per_Page)+1; $Num_Pages = (int)$Num_Pages; } $result .=" order by stamp LIMIT $Page_Start , $Per_Page"; $objQuery = mysql_query($result); ?> <table id="ticket" <tr> <th> <div align="center">Ticket No</div></th> <th> <div align="center">Date</div></th> <th> <div align="center">Issue Type</div></th> <th> <div align="center">Status</div></th> <th> <div align="center">view</div></th> </tr> <? while($row = mysql_fetch_array($objQuery)) { ?> <tr> <td><div align="center"><?=$row["id"];?></div></td> <td><div align="center"><?=$row["stamp"];?></div></td> <td><div align="center"><?=$row["issue"];?></div></td> <td><div align="center"><?=$row["status"];?></div></td> <td><div align="center"><a href="edit.php?id='$row['id']'">Update</a></div></td> </tr> <? } ?> </table> <br> Total <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page : <? if($Prev_Page) { echo " <a href='$_SERVER[sCRIPT_NAME]?Page=$Prev_Page&txtKeyword=$_GET[txtKeyword]'>Back</a> "; } for($i=1; $i<=$Num_Pages; $i++){ if($i != $Page) { echo "[ <a href='$_SERVER[sCRIPT_NAME]?Page=$i&txtKeyword=$_GET[txtKeyword]'>$i</a> ]"; } else { echo "<b> $i </b>"; } } if($Page!=$Num_Pages) { echo " <a href ='$_SERVER[sCRIPT_NAME]?Page=$Next_Page&txtKeyword=$_GET[txtKeyword]'>Next</a> "; } mysql_close($objConnect); } ?> Link to comment https://forums.phpfreaks.com/topic/246295-help-in-identifying-where-the-error-is/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.