text search box record limit on php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ashjok
    New Member
    • May 2014
    • 1

    text search box record limit on php

    hi!
    my php code was text box value to get,in display only 10 record another record next page but 2 page record are not display...

    code.......

    Code:
    <?php 
    $con=mysql_connect('localhost','root','');
    mysql_select_db('ashok_test');
    ?> <div id=""> <form action="http://bytes.com/" method="POST"> <input type="text" name="software_search" id="software_search" > <input type="submit" name="softSearch"> </div> <div id="softwaretables1" align="center"> <h1><b><i>Software Information</i></b></h1> <table id="hovertable" border="0"> <tr id="title"> <td id="id">	
    Id
    </td> <td>
    			Manufacture Name
    		</td> <td>
    			Software Name
    		</td> <td>
    			Version
    		</td> <td>
    			Product Id
    		</td> <td>
    			Manufacture Date
    		</td> <td>
    			Active Date
    		</td> <td>
    			Expired Date
    		</td> <td>
    			Licence
    		</td> <td>
    			Add
    		</td> <td>
    			Edit
    		</td> <td>
    		Delete
    		</td> </tr> <?php
    //$start_from = ($page-1) * 3; 
    //$sql =mysql_query("SELECT COUNT(Software_Name) FROM sofware_detail where Software_Name='$search'"); 
    if (isset($_GET["page"])) 
    { 
    
    		$page  = $_GET["page"]; 
    		
    		echo "page1",$page,"<br>";
    
    
    } 
    else {
    		
    		 $page=1; 
    
    
    
    
    
    }; 
    
    		$start_from = ($page-1) * 3; 
    		echo "Page no=",$page,"<br>";
    		echo "starting row=",$start_from,"<br>";
    		$search=$_POST['software_search'];
    		
    
    		echo "text_Search=",$search,"<br>";
    		$sss = $search;
    
    		$query=mysql_query("select * from  sofware_detail where Software_Name='$search' limit $start_from,3");
    
    		 $sql =mysql_query("SELECT COUNT(Software_Name) FROM sofware_detail where Software_Name='$search'"); 
    
    		$rows = mysql_fetch_row($sql); 
    		
    		$total_records = $row[0]; 
    		
    		echo "total Record=",$total_records,"<br>";
    		$total_pages = ceil($total_records / 3); 
    		echo "total Page=",$total_pages,"<br>";
    		for ($i=1; $i<=$total_pages; $i++) 
    		{ 
    			echo "<a href='count1.php?page=".$i."".$search."'>".$i."</a> "; 
    				
    		};
    		while($row=mysql_fetch_array($query))
    		
    		{
    		
    		?> <tr onmouseover="this.style.backgroundColor='#ACB0C2';" onmouseout="this.style.backgroundColor='';" id="content"> <td backgroundColor='#30818B'><? echo
    					$row['id'];?> </td> <td><? echo	$row[1];?> </td> <td><? echo$row['Software_Name'];?> </td> <td> <? echo$row['version'];?> </td> <td><? echo$row['serial_number'];?> </td> <td> <? echo$row['manufacture'];?> </td> <td> <? echo$row['active_date'];?> </td> <td> <? echo$row['expery'];?> </td> <td> <? echo$row['licence'];?> </td> <td> <a href="SW_Info_edit.php?id=<?echo $row['id'];?>"><IMG SRC="http://server01/ashok/5-3-2014/edit-validated-icon.png" id="edit_image" ></a> </td> <td> <a href="JavaScript:if(confirm('Are you sure you want to delete this record?')==true)
    									{window.location='SW_Info_delete.php?id=<?php echo $row["id"];?>';}"><IMG SRC="http://server01/ashok/5-3-2014/images.jpg" id="delete_img" ></a> </td> <td> </td> </IMG> </tr> <?}?>
    Last edited by Rabbit; May 30 '14, 03:51 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
  • Luuk
    Recognized Expert Top Contributor
    • Mar 2012
    • 1043

    #2
    after "code...... ." you should have used the button in the toolbar that says '[CODE/]'

    Comment

    Working...