as we go inside a category the link shoul apear on the view page any one help....

i have done this much so far

<?php 
include("connectivity.php");
$parentid=$_REQUEST['parentid'];
if(!$parentid)
{
$parentid=0;
}
$a=$_REQUEST['a'];
if(!$a)
{
$a=0;
}
$qry=mysql_query("select * from category where iparentid='$parentid' limit $a,4");
$qrynum=mysql_query("select * from category where iparentid='$parentid'");
$num=mysql_num_rows($qrynum);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>view</title>
</head>
<body>
<h2 align="center">category</h2>
<table align="center" border="3"/>
<tr><td colspan="3" align="right"><a href="add.php?parentid=<?php echo $parentid; ?>">Add</a></td></tr>
<tr><td>sl.no</td><td>category</td><td>description</td></tr>
<?php
//prev code
if($a>0)
{
$a=$a-4;
echo "<a href=\"view.php?a=$a&parentid=$parentid\">prev</a>&nbsp;&nbsp;";
$a=$a+4;
}
//prev code ends here
//page no
$div=$num/4;
$rem=$num%4;
if($rem>0)
{
$div=$div+1;

}
$b=0;
for($i=1;$i<=$div;$i++)
{
if($a==$b)
{
echo "<a href=\"view.php?a=$b&parentid=$parentid\"><font color='red'>$i</font></a>&nbsp;&nbsp;";
}
else
{
echo "<a href=\"view.php?a=$b&parentid=$parentid\">$i</a>&nbsp;&nbsp;";
}
$b=$b+4;
}
//
//next code starts here
$a=$a+5;
if($a<$num)
{
echo "<a href=\"view.php?a=$a&parentid=$parentid\">Next</a>&nbsp;&nbsp;";
}
$a=$a-5;
//next code ends here
?>
<?php 
$sl=1+$a;
while($obj=mysql_fetch_object($qry))
{
echo "<tr>";

echo "<td>$sl</td>";

echo "<td><a href=\"view.php?parentid=$obj->icatid\">$obj->vcategory</a></td>";

echo "<td>$obj->vdescription</td>";

echo "</tr>";

$sl++;
}
?>
</table>
</body>
</html>

Recommended Answers

All 7 Replies

I mean as we go inside the category the previous pages should appear as link on side of the view page

I think if you clean up your code you will get more responses.
Also what you are requesting is?
OPEN A THEN OPEN 1 THEN OPEN A1
Previous list (A then 1 then A1) should appear so the person is able to go back one catergory correct?

I think if you clean up your code you will get more responses.
Also what you are requesting is?
OPEN A THEN OPEN 1 THEN OPEN A1
Previous list (A then 1 then A1) should appear so the person is able to go back one catergory correct?

yes what you said is right.....

Im trying to figure out how you are retrieving your variables?
Through sent data or a database?
Is any of your information ever stored on a database - link wise?
I can try figure out a solution if I know what your working with.

Im trying to figure out how you are retrieving your variables?
Through sent data or a database?
Is any of your information ever stored on a database - link wise?
I can try figure out a solution if I know what your working with.

ya i store data in data base,and variables are retrived through database

ya i store data in data base,and variables are retrived through database

Thank you so much that you took the effort to go through my code. anyways i worked it out.thank you

Your welcome, everyone needs help sometime in their life :)

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.