sup? all i just find a code to edit table in mysql but i don't know how to set it have to login every i go to login page if anyone can help me out that will great
birthdays_login.php
birthdays_change_form.phpPHP Code:<html><head><title>Birthdays Login</title>
<style type="text/css">
form{ font-family: Arial ,sans-serif;font-style : normal ;font-size : 9pt; font-weight :normal}
</style>
</head>
<body>
<div align="center">
<table width="350" cellpadding="10" cellspacing="0" border="2">
<tr align="center" valign="top">
<td align="left" colspan="1" rowspan="1" bgcolor="#64B1FF">
<form method="POST" action="birthdays_dbase_interface.php">
<?
print "Enter Username: <input type=text name=username size=20><br>\n";
print "Enter Password: <input type=password name=password size=20><br>\n";
print "<br>\n";
print "<input type=submit value=Submit><input type=reset>\n";
?>
</form>
</td></tr></table>
</div>
</body>
</html>
PHP Code:<html><head><title></title></head>
<body>
<?
$id=$_POST['id'];
$db="mydatabase";
$link = mysql_connect(localhost,$_POST['username'],$_POST['pass']);
//$link = mysql_connect("localhost");
if (! $link)
die("Couldn't connect to MySQL");
mysql_select_db($db , $link)
or die("Couldn't open $db: ".mysql_error());
$query=" SELECT * FROM birthdays WHERE id='$id'";
$result=mysql_query($query);
$num=mysql_num_rows($result);
$i=0;
while ($i < $num) {
$name=mysql_result($result,$i,"name");
$birthday=mysql_result($result,$i,"birthday");
?>
<table width="300" cellpadding="10" cellspacing="0" border="2">
<tr align="center" valign="top">
<td align="center" colspan="1" rowspan="1" bgcolor="#64b1ff">
<h3>Edit and Submit</h3>
<form action="birthdays_change_record.php" method="post">
<input type="hidden" name="username" value="<?php print $_POST['username']?>">
<input type="hidden" name="pass" value="<?php print $_POST['pass']?>">
<input type="hidden" name="ud_id" value="<? echo "$id" ?>">
Name: <input type="text" name="ud_name" value="<? print "$name"?>"><br>
Birthday: <input type="text" name="ud_birthday" value="<? echo "$birthday"?>"><br>
<input type="Submit" value="Update">
</form>
</td></tr></table>
<?
++$i;
}
?>
</body>
</html>
birthdays_change_record.php
PHP Code:<html><head><title></title></head>
<body>
<?
$user=$_POST['username'];
$password=$_POST['password'];
$ud_id=$_POST['ud_id'];
$ud_name=$_POST['ud_name'];
$ud_birthday=$_POST['ud_birthday'];
$db="mydatabase";
$link = mysql_connect("localhost",$_POST['username'],$_POST['password']);
//$link = mysql_connect("localhost");
if (! $link)
die("Couldn't connect to MySQL");
mysql_select_db($db , $link)
or die("Couldn't open $db: ".mysql_error());
mysql_query(" UPDATE birthdays SET name='$ud_name' ,birthday='$ud_birthday' WHERE id='$ud_id'");
echo "Record Updated";
mysql_close($link);
?>
<form method="POST" action="birthdays_update_form.php">
<input type="hidden" name="username" value="<?php print $_POST['username']?>">
<input type="hidden" name="pass" value="<?php print $_POST['password']?>">
<input type="submit" value="Change Another">
</form><br>
<form method="POST" action="birthdays_dbase_interface.php">
<input type="hidden" name="username" value="<?php print $_POST['username']?>">
<input type="hidden" name="pass" value="<?php print $_POST['password']?>">
<input type="submit" value="Dbase Interface">
</form>
</body>
</html>





Reply With Quote