<?php

        include 'session.inc';
            check_login();



            $con=mysql_connect("localhost","root","");
            if(!$con)
                die('Could not connect:' .mysql_error());

            mysql_select_db("vms", $con);

                if($_POST[product]!='NONE')
                {

                    $product=$_POST[product];                                       
                }   
                else
                {
                    $product='NONE';
                }           
                $expire=time()+60*60;   
                setcookie("product",$product,$expire);

                if(product!='NONE')
                {

// how many rows to show per page
$rowsPerPage = 20;

// by default we show first page
$pageNum = 1;
// if $_POST['page'] defined, use it as page number
if(isset($_POST['page']))
{
echo "page:".$_POST['page'];
$pageNum = $_POST['page'];
}

// counting the offset

$offset = ($pageNum - 1) * $rowsPerPage;


$query="SELECT CRNo AS CR,DescriptionCR AS DCR FROM cr where Product='".$product."' ORDER BY CR"." . LIMIT $offset, $rowsPerPage";
                    $result = mysql_query($query);
                    $i=0;
                    $TotalNoOfCR=0;
                    $checkcr=0;
                    while($row = mysql_fetch_array($result))
                    {   
                        $CR[$i]=$row['CR'];
                        $row['DCR']=str_replace("\'","'",$row['DCR']);
                        $DCR[$i]=$row['DCR'];
                        $TotalNoOfCR=$i;
                        $checkcr=1;             
                        $i++;
                    }


$query="SELECT CRNo AS CR,DescriptionCR AS DCR FROM cr where Product='".$product."' ORDER BY CR".";
                    $result = mysql_query($query);
                    $i=0;
                    $numrows=0;

                    while($row = mysql_fetch_array($result))
                    {   
                        $numrows=$i;

                        $i++;
                    }


$maxPage = ceil($numrows/$rowsPerPage);
// print the link to access each page
$self='Upd_provsCRform.php';

$nav ='';

for($page = 1; $page <= $maxPage; $page++)
{

if ($page == $pageNum)


$nav .= "$page"  ; //  [QUOTE]getting error on this line [/QUOTE]no need to create a link to current page 


else
$nav .="<a href=\"$self?page=$page\">$page</a>"; 

}
// creating previous and next link
// plus the link to go straight to
// the first and last page
if ($pageNum > 1)
{
$page = $pageNum - 1;
$prev = " <a href=\"$self?page=$page\">[Prev]</a> ";

$first = " <a href=\"$self?page=1\">[First Page]</a> ";
} 
else
{
$prev = '&nbsp;'; // we're on page one, don't print previous link
$first = '&nbsp;'; // nor the first page link
}
if ($pageNum < $maxPage)
{
$page = $pageNum + 1;
$next = " <a href=\"$self?page=$page\">[Next]</a> ";

$last = " <a href=\"$self?page=$maxPage\">[Last Page]</a> ";
} 
else
{
$next = '&nbsp;'; // we're on the last page, don't print next link
$last = '&nbsp;'; // nor the last page link
}
// print the navigation link
echo $first . $prev . $nav . $next . $last;
// and close the database connection*/
mysql_close($con);


}









                $query="SELECT projectName AS project FROM project_details ORDER BY project";
                $result = mysql_query($query);
                $i=0;
                $TotalNoOfProject=0;
                while($row = mysql_fetch_array($result))
                {   
                    $PR[$i]=$row['project'];
                    $TotalNoOfProject=$i;                                   
                    $i++;                   
                }   




                $query="SELECT status as S,shortstatus as SS FROM cr_status";
                $result = mysql_query($query); 
                $i=0;              
                $TotalNoOfStatus=0;    
                while($row = mysql_fetch_array($result))
                {
                    $status[$i]=$row['S'];
                    $shortstatus[$i]=$row['SS'];
                    $TotalNoOfStatus=$i;
                    $i++;
                }   
?>

Recommended Answers

All 4 Replies

specify exactly what problem you are facing, error message, unexpected output or some thing like that.

specify exactly what problem you are facing, error message, unexpected output or some thing like that.

Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\Final\Upd_provsCRform.php on line 84

this error i am getting

Remove the red portion. The .(dot) and "(double quote)
It is not required.

$query="SELECT CRNo AS CR,DescriptionCR AS DCR FROM cr where Product='".$product."' ORDER BY CR".";
$result = mysql_query($query);
$i=0;
$numrows=0;

while($row = mysql_fetch_array($result))
{
$numrows=$i;

$i++;
}

still the same error is coming...

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.