View: 2575|Reply: 7
|
php mysql : leh ke nak buat system ala-ala library
[Copy link]
|
|
salam semua.
aku nie tgh belajar sendiri pasal php mysql. so nak tnya la otai-otai sume, macamana aku nak buat satu sistem personal library untuk aku rekod sume buku-buku yang aku ada. pastuh let say klu ada org pinjam, aku leh tau sape y pinjam, bile pinjam, bile nk return etc. kiranya macam sistem library kat uni jugak la.
ok ke kalau beginner cam aku nie start2 ngn projek cenggini? ke susah sangat nak buat?
kalau ada cadangan/penambah-baikan, share2 la ye ngn aku |
|
|
|
|
|
|
|
tenkiu cluesan
tak jumpa code y aku nak. tapi jumpa code library untuk dvd. aku try test ngn ni ar dlu. kira lebey-lebey kurang ar |
|
|
|
|
|
|
|
aku kurang faham camane nak delete entry. mintak tunjuk ajar ye
nih code y aku cilok dari planet-source-code- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html>
- <head>
- <title>DVDlib : Administration Panel</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- </head>
- <body leftmargin="0" topmargin="0">
- <table width="72%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td width="23%"><img src="images/topcorner.jpg" width="208" height="120"></td>
- <td width="77%"><img src="images/topbar.jpg" width="549" height="120"></td>
- </tr>
- <tr>
- <td valign="top"><img src="images/leftfoot.jpg" width="193" height="211" border="0" usemap="#Map">
- <map name="Map">
- <area shape="rect" coords="16,24,140,46" href="admin.php">
- <area shape="rect" coords="20,59,84,74" href="search.php">
- <area shape="rect" coords="18,91,75,107" href="index.php">
- </map></td>
- <td valign="top"><div align="center">
- <p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>
- <?
- include("includes/config.php");
- $ip = $REMOTE_ADDR;
-
- $link = mysql_connect( $dbhost, $dbuser, $dbpass);
- if ( ! $link)
- die("Error: Could Not Connect To MySQL");
- mysql_select_db($db) or die("Error: Could Not Open Database, Is DVDlib Installed?");
- $ipcheck = mysql_query("SELECT userip FROM user WHERE userip = '$ip'");
- if (mysql_num_rows($ipcheck) > 0) {
- $result = mysql_query("SELECT * FROM user WHERE userip = '$ip'");
- while($row = mysql_fetch_array($result)) {
-
- ?>
- Delete An Entry From Database</strong></font></p>
- <p><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a href="add.php">Add
- An Entry</a>| <em>Delete An Entry</em> | <a href="edit.php">Edit An
- Entry</a> | <a href="viewall.php?record=all">View All Entries</a> |
- <a href="admin.php?content=logout">LogOut </a></font></strong></p>
-
-
- <font size="2" face="Verdana, Arial, Helvetica, sans-serif">
- <?
-
- $link = mysql_connect($dbhost, $dbuser, $dbpass);
- if (! $link)
- die("Error: Could Not Connect To MySQL");
- mysql_select_db($db) or die("Error: Could Not Open Database, Is DVDlib Installed?");
- $alldb = mysql_query("SELECT title FROM dvd");
- $num_dvd = mysql_num_rows($alldb);
- echo "There Are <strong>$num_dvd </strong>Entries In The Database";
- echo "<form name="Delete" method="post" action="delete.php">";
- echo "<select name="Movies" id="Movies">";
- while ( $a_dvd = mysql_fetch_row($alldb)) {
- foreach ( $a_dvd as $dvd )
- echo "<option value="" . $dvd . "">" . $dvd . "</option>";
- }
- echo "</select>";
- echo "<input type="submit" name="Delete" value="Delete">";
- echo "</form>";
- mysql_close($link);
- ?>
- <BR>
- <?
-
- $title = $_POST["Movies"];
-
- if ($Delete == "") {
- echo "Warning: Be sure of what you want before deleting. This Is Can't Be Canceled";
- } else {
- $link = mysql_connect($dbhost, $dbuser, $dbpass);
- if (! $link)
- die("Error: Could Not Connect To MySQL");
- mysql_select_db($db) or die("Error: Could Not Open Database, Is DVDlib Installed?");
- $query = mysql_query("DELETE FROM dvd WHERE title = '$title'") or die("Error: Could Not Delete Entry");
- echo "$title Was Removed From Database";
- mysql_close($link);
- redirect("delete.php");
- }
- }
-
- ?>
- </font></div></td>
- </tr>
- <tr>
- <td> </td>
- <td><div align="center"><? include("includes/footer.php"); ?>
- </div>
- </td>
- </tr>
- </table>
- <?
-
- } else {
- redirect("login.php");
- }
- ?>
- <?
- function redirect($url){
- die('<meta http-equiv="refresh" content="0;URL='.$url.'">');
- }
- ?>
- </body>
- </html>
Copy the Code
tulun explain y part delete tuh leh? aku kurang memahami
[ Last edited by lamka_13 at 29-9-2008 02:47 AM ] |
|
|
|
|
|
|
|
thx cluesan, bmw...
skang nie tgh mode raya lagi... nti bile dah abes raye, aku akn smbung projek ni |
|
|
|
|
|
|
|
antara perkara paling penting nak develop system ialah database..
kau dah design database x untuk project kau ni?? |
|
|
|
|
|
|
| |
|