Member Avatar for kirtan_thakkar

I have a database and will search with that database..
I want to show only first 5 results in the page and generate the "next" button for the next 5 results and on the 6-10 results page generate "next" button for the next results and the "previews" button for the previews results..

Can any one code it in php..??

My table have three fields
one field is name.....
So want to display results via name because name repeats many times..

Recommended Answers

All 5 Replies

Member Avatar for nileshgr

Please explain your problem correctly, and also share your existing code if any.

i have the code but no time to edit to fit your 3 fields ... can i give you to do the editing yourself...

Member Avatar for kirtan_thakkar

Yes, Sure..
Thank you

Member Avatar for kirtan_thakkar

i have the code but no time to edit to fit your 3 fields ... can i give you to do the editing yourself...

Yes, Sure..
Thank you

Member Avatar for kirtan_thakkar
<?php

$link = mysql_connect("localhost", "user", "pass") or die("Could not connect".mysql_error());
mysql_select_db("user") or die("Could not select Database");


include("index.php");

$query = "SELECT * FROM all WHERE name='Kirtan' ORDER BY id";

// execute query 
$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); 

echo "<center><font face=verdana><table>";


for($n=1;$n<=5;$n++)
{
 $row =  mysql_fetch_object($result);
          
 $id = $row -> id ;

 $name = $row -> name ;

 $info = $row -> info ;

echo "<tr><tr><td>Result No:".$n;
echo("and ID:");
echo($id);
echo("<tr><td> * ");
echo($info);
echo("<tr><td align=center>-");
echo($name);

}

And I have to create a page for the next five results...

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.