apple
1: Page: db.php
// to make connection
<?php
mysql_connect("localhost","root","");
mysql_select_db('login');
echo "Login database";
?>
//////////End///////////
2: Page index.php
<?php
include "db.php";
if(isset($_POST['enter'])) {
$name =$_POST['name'];
echo $name;
$in = "insert into apple (name) values('$name')";
$re = mysql_query($in);
}
$show = "select * from apple ";
$results =mysql_query($show);
// to make connection
<?php
mysql_connect("localhost","root","");
mysql_select_db('login');
echo "Login database";
?>
//////////End///////////
2: Page index.php
<?php
include "db.php";
if(isset($_POST['enter'])) {
$name =$_POST['name'];
echo $name;
$in = "insert into apple (name) values('$name')";
$re = mysql_query($in);
}
$show = "select * from apple ";
$results =mysql_query($show);
echo "<table class=\"table table-striped\">
<tr>
<th>ID</th>
<th>Name</th>
<th>Edit</th>
<th>Delete</th>
<th>insert</th>
</tr>";
while ($row = mysql_fetch_array($results))
{
echo "<tr>";
echo "<td>". $row['id']. "</td>";
echo "<td>".$row['name']. "</td>";
echo "<td>". "<a href='edit.php?edit=$row[id]'>edit</a>" ."</td>";
echo "<td>". "<a href='delete.php?delete=$row[id]' onclick=\"return confirm('Are you sure you want to delete this item?');\">Delete</a>" . "</td>";
echo "<td>". "<a href ='insert.php?insert=$row[id]'>Insert</a>" . "</td>";
echo "</tr>";
}
?> //////////End///////////
Comments
Post a Comment