2
Contributors
4
Replies
38
Views
2 Years
Discussion Span
Last Post by AntonyRayan
0

U're welcome :-). Once you have some code and if you get stuck, post the code you have. If you manage to finish it yourself, please mark the thread as solved.

Happy coding.

0
this is my view_category.php::
<!DOCTYPE html>
<html lang="en">

<head>



  </head>

  <body>
<?php
include('include/header.html');
?>





  <?php 
include('connect_category.php');
$r=mysql_query("select * from tbl_category") or die(mysql_error());
$count = mysql_num_rows($r);                                
if($count > 0)
{
?>

                                <table>
                                    <thead>
                                        <tr>
                                            <th>#</th>
                                            <th> Category Name</th>
                                            <th>Description</th>
                                            <th>Rack No</th>
                                            <th>Action</th>
                                        </tr>
                                    </thead>


<?php
$i=1;
while($newr=mysql_fetch_array($r))
{
$id=$newr['id'];
echo "<tr>
     <td>".$i."</td> 
    <td>".$newr['categoryname']."</td>
    <td>".$newr['description']."</td>
    <td>".$newr['rackno']."</td>

    <td> 
    <a href='edit_category.php?ed_id=".$id."'><span class='label label-info'>Edit</span></a>

    <a href='delete_category.php?del_id=".$id."'><span class='label label-important'>Delete</span></a></td>
</tr>";
?>
<?php
$i++;
}
} 
else
{
?>

<table>
                                    <thead>
                                        <tr>
                                            <th>#</th>
                                            <th> Category Name</th>
                                            <th>Description</th>
                                            <th>Rack No</th>
                                            <th>Action</th>
                                        </tr>
                                    </thead>


</table>
<div align="center">
No records found.
 <a href="add_category.php"> Add book to library</a>
 </div>   
<?php
}
echo '</table>';
?>
</body>


</html>


this is my delete_category.php""::

<?php
include('connect_category.php');
$del_id=$_REQUEST['del_id'];
echo '<script type="text/javascript">confirm("Are you sure want to delete?");</script>';
if(confirm)
{
mysql_query("delete from tbl_category WHERE id='$del_id'")or die(mysql_error());
echo '<script type="text/javascript">alert("Deleted sucessfully");window.location.href="view_category.php";</script>'; // header("Location: index.php");
}
else
{
echo '<script type="text/javascript">alert("You cancelled.");window.location.href="view_category.php";</script>';
}
?>
 the lese part is not working.. give me the solution
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.