Announcements | Last Post | |
---|---|---|
SoC Curricula | 09/30/2017 01:08PM | |
Demarcation or scoping of examinations and assessment | 02/13/2017 07:59AM | |
School of Computing Short Learning Programmes | 11/24/2014 08:37AM | |
Unisa contact information | 07/28/2011 01:28PM |
DELETE and EDIT October 08, 2013 04:55PM |
Registered: 10 years ago Posts: 9 Rating: 0 |
Re: DELETE and EDIT October 10, 2013 08:27AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: DELETE and EDIT October 11, 2013 11:26AM |
Registered: 10 years ago Posts: 16 Rating: 0 |
Language: PHP<?php session_start(); if (!(!(isset($_SESSION[';login';]) && $_SESSION[';login';] != ';';))) { header("Location: login.php"); } if (isset($_POST[';Submit';])) { //Checking if the submit button was clicked //Assigning form data to variables $player_id = $_POST[';player_id';]; echo $player_id; $fname = $_POST[';fname';]; $sname = $_POST[';sname';]; $cnumber = $_POST[';cnumber';]; $email = $_POST[';email';]; $pos = $_POST[';pos';]; $uname = $_POST[';uname';]; $pword = $_POST[';pword';]; include("connect.php"); if (!$db) //Check connection { echo "Could not connect to the database."; } else { //Update the table $query = "UPDATE clubdata playerregistration SET player_name = ';$fname';, player_surname = ';$sname';, player_contact_num = ';$cnumber';, player_email = ';$email';, player_position = ';$pos';, player_username = ';$uname';, player_password = ';$pword'; WHERE player_id = ';$player_id';"; $result = mysql_query($query); if ($result) { echo "Player';s information updated successfully"; } else { echo "Failed to update player';s information."; } mysql_close($connection); } } //form to display the player';s information to be edited echo "<div align=';center';>"; echo "<form method=';post'; action=';edit.php'; >"; echo "<table cellpadding=';5'; bgcolor=';aqua'; border>"; //table to hold the data in the form aligned echo "<td colspan=';2';>    Player';s details to be edited:</td></tr>"; echo "<input name=';player_id'; type=';hidden'; value=';", $player_id, "';>"; echo "<tr>"; echo "<td>Name: </td>"; echo "<td><input name=';fname'; type=';text'; value=';", $fname, "';></td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Surname: </td>"; echo "<td><input name=';sname'; type=';text'; value=';", $sname, "';></td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Contact number: </td>"; echo "<td><input name=';cnumber'; type=';text'; value=';", $cnumber, "';></td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Email: </td>"; echo "<td><input name=';email'; type=';text'; value=';", $email, "';></td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Position: </td>"; echo "<td><input name=';pos'; type=';text'; value=';", $pos, "';</td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Username: </td>"; echo "<td><input name=';uname'; type=';text'; value=';", $uname, "';></td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Password: </td>"; echo "<td><input name=';pname'; type=';text'; value=';", $pword, "';></td></tr>"; echo "<br />"; echo "<tr >"; echo "<td align=';center'; colspan=';2';><input type=';Submit'; value=';Update';></td></tr>"; echo "</table>"; echo "</form>"; //end of the form echo "</div>"; ?>
Language: PHP<?php //Delete page session_start(); if (!(!(isset($_SESSION[';login';]) && $_SESSION[';login';] != ';';))) { header("Location: login.php"); } $player_id = $_POST[';player_id';]; $fname = $_POST[';fname';]; $sname = $_POST[';sname';]; $cnumber = $_POST[';cnumber';]; $email = $_POST[';email';]; $pos = $_POST[';pos';]; $uname = $_POST[';uname';]; $pword = $_POST[';pword';]; include("connect.php"); if (!$db) //Check connectiom { echo "Could not connect to the database"; } else { // if connection was established if (isset($_GET[';player_id';]) == $_player_id ){ // Check if yes was chosen to definetely delete $query = "DELETE * FROM playerregistration WHERE player_id = $player_id"; //use $result = mysql_query($query); if ($result) { echo "Player deleted successfully."; } else { echo "Failed to delete a player."; } mysql_close($connection); } } //Option[yes or no] to make sure that the user really wants to delete the player echo "Are you sure you want to delete $fname?<a href=delete.php?player_id=$player_id>Yes</a> <a href=list_players.php>No</a>"; //form to dispay the player';s information to be deleted $fname = $_POST[';cnumber';]; $email = $_POST[';email';]; $pos = $_POST[';pos';]; $uname = $_POST[';uname';]; $pword = $_POST[';pword';]; echo "<div align=';center';>"; echo "<form2 method=';post'; >"; echo "<table cellpadding=';5'; bgcolor=';aqua'; border>"; //table to hold the data in the form aligned echo "<td colspan=';2';>    Details of the player to be deleted:</td></tr>"; echo "<tr>"; echo "<td>Name: </td>"; echo "<td><input name=';fname'; type=';hidden'; value= ';$fname';></td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Surname: </td>"; echo "<td><input name=';sname'; type=';hidden'; value=';player_surname'; value=';", $sname, "';></td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Contact number: </td>"; echo "<td><input name=';cnumber'; type=';hidden'; value=';player_contact_num'; value=';", $cnumber, "';></td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Email: </td>"; echo "<td><input name=';email'; type=';hidden'; value=';player_email'; value=';", $email, "';></td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Position: </td>"; echo "<td><input name=';pos'; type=';hidden'; value=';player_pos value=';", $pos, "';</td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Username: </td>"; echo "<td><input name=';uname'; type=';hidden'; value=';player_username'; value=';", $uname, "';></td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Password: </td>"; echo "<td><input name=';pword'; type=';hidden'; value=';player_password'; value=';", $pword, "';></td></tr>"; echo "<br />"; echo "</table>"; echo "</form2>"; //end of the form echo "</div>"; ?>
Re: DELETE and EDIT October 11, 2013 11:43AM |
Admin Registered: 11 years ago Posts: 6,606 Rating: 396 |
Re: DELETE and EDIT October 11, 2013 11:55AM |
Registered: 11 years ago Posts: 106 Rating: 0 |
Language: PHPAre you sure you want to delete $fname?<a href=delete.php?player_id=$player_id ?player_id=$player_id&Action=yes
Re: DELETE and EDIT October 11, 2013 12:13PM |
Admin Registered: 11 years ago Posts: 6,606 Rating: 396 |
Language: PHPif (isset($_GET[';player_id';]) == $_player_id ){ // Check if yes was chosen to definetely delete
Re: DELETE and EDIT October 11, 2013 01:37PM |
Admin Registered: 11 years ago Posts: 6,606 Rating: 396 |
Re: DELETE and EDIT October 11, 2013 09:17PM |
Registered: 10 years ago Posts: 16 Rating: 0 |
Language: PHPif ($result1) { echo "Please update the player';s information"; //Inform the user to edit the data in the form if needed if (isset($_POST[';Submit';])) //Checking if the submit button was clicked { $player_id = $_GET[';player_id';]; //Update the table $query = "UPDATE playerregistration SET player_name = ';$fname';, player_surname = ';$sname';, player_contact_num = ';$cnumber';, player_email = ';$email';, player_position = ';$pos';, player_username = ';$uname';, player_password = ';$pword'; WHERE player_id = ';$player_id';"; $result = mysql_query($query); if ($result) { echo "Player';s information updated successfully"; } else { echo "Failed to update player';s information."; } mysql_close($connection); }
Language: PHPif (isset($_POST[';Submit';])) //Checking if the submit button was clicked
Re: DELETE and EDIT October 11, 2013 09:57PM |
Admin Registered: 11 years ago Posts: 6,606 Rating: 396 |
Language: PHPif (isset($_POST[';Submit';])) //Checking if the submit button was clicked { $player_id = $_GET[';player_id';];
Re: DELETE and EDIT October 12, 2013 08:56AM |
Admin Registered: 11 years ago Posts: 6,606 Rating: 396 |
Language: PHPif (isset($_POST[';Submit';])) //Checking if the submit button was clicked
Re: DELETE and EDIT October 15, 2013 10:07AM |
Registered: 10 years ago Posts: 59 Rating: 0 |
Re: DELETE and EDIT October 15, 2013 11:08AM |
Admin Registered: 11 years ago Posts: 6,606 Rating: 396 |
Re: DELETE and EDIT October 15, 2013 12:31PM |
Registered: 10 years ago Posts: 59 Rating: 0 |
Re: DELETE and EDIT October 16, 2013 05:19AM |
Registered: 10 years ago Posts: 16 Rating: 0 |
Language: PHP<?php session_start(); if (!(!(isset($_SESSION[';login';]) && $_SESSION[';login';] != ';';))) { header("Location: login.php"); } include("connect.php"); if (!$db) //Check connection { echo "Could not connect to the database."; } if (isset($_POST[';Submit';])) //Checking if the submit button was clicked { $player_id = $_POST[';player_id';]; //$player_id = $_GET[';player_id';]; //Update the table $query = "UPDATE playerregistration SET player_name = ';$fname';, player_surname = ';$sname';, player_contact_num = ';$cnumber';, player_email = ';$email';, player_position = ';$pos';, player_username = ';$uname';, player_password = ';$pword'; WHERE player_id = ';$player_id';"; $result = mysql_query($query); if ($result) { echo "Player';s information updated successfully"; //Was the data updated? } else { echo "Failed to update player';s information."; } mysql_close($connection); } //Read data from the table and present it in the form $player_id = $_GET[';player_id';];//Get the player_id from URL if ($player_id) { $query1 = "SELECT * FROM playerregistration WHERE player_id = ';$player_id';";//Read a player';s details from table based on player_id from list $result1 = mysql_query($query1) or die("Query failed: " . mysql_error()); if ($result1)//Is data returned from the query? { while ($row = mysql_fetch_array($result1)) { //Assigning retrieved data from the table into the form $fname = $row[';player_name';]; $sname = $row[';player_surname';]; $cnumber = $row[';player_contact_num';]; $email = $row[';player_email';]; $pos = $row[';player_position';]; $uname = $row[';player_username';]; $pword = $row[';player_password';]; } echo "Please update " . $fname . " " . $sname . ';\';s'; . '; '; . "information"; //Inform the user to edit the data in the form if needed } } //form to display the player';s information to be edited echo "<div align=';center';>"; echo "<form method=';post';>"; echo "<table cellpadding=';5'; bgcolor=';aqua'; border>"; //table to hold the data in the form aligned echo "<td colspan=';2';>    Player';s details to be edited:</td></tr>"; echo "<input name=';player_id'; type=';hidden'; value=';", $player_id, "';>"; echo "<tr>"; echo "<td>Name: </td>"; echo "<td><input name=';fname'; type=';text'; value=';", $fname, "';></td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Surname: </td>"; echo "<td><input name=';sname'; type=';text'; value=';", $sname, "';></td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Contact number: </td>"; echo "<td><input name=';cnumber'; type=';text'; value=';", $cnumber, "';></td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Email: </td>"; echo "<td><input name=';email'; type=';text'; value=';", $email, "';></td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Position: </td>"; echo "<td><input name=';pos'; type=';text'; value=';", $pos, "';</td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Username: </td>"; echo "<td><input name=';uname'; type=';text'; value=';", $uname, "';></td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Password: </td>"; echo "<td><input name=';pname'; type=';text'; value=';", $pword, "';></td></tr>"; echo "<br />"; echo "<tr >"; echo "<td align=';center'; colspan=';2';><input type=';Submit'; value=';Update';></td></tr>"; echo "</table>"; echo "</form>"; //end of the form echo "</div>"; ?>
Language: PHP<?php //Delete page session_start(); if (!(!(isset($_SESSION[';login';]) && $_SESSION[';login';] != ';';))) { header("Location: login.php"); } $player_id = $_GET[';player_id';]; //Get the player_id from the URL $fname = $_POST[';fname';]; $sname = $_POST[';sname';]; $cnumber = $_POST[';cnumber';]; $email = $_POST[';email';]; $pos = $_POST[';pos';]; $uname = $_POST[';uname';]; $pword = $_POST[';pword';]; include("connect.php"); if (!$db) //Check connectiom { echo "Could not connect to the database"; } else { // if connection was established //Read data from the table and present it in the form $player_id = $_GET[';player_id';];//Get the player_id from URL $query1 = "SELECT * FROM playerregistration WHERE player_id = ';$player_id';";//Read a player';s details from table based on player_id from list $result1 = mysql_query($query1) or die("Query failed: " . mysql_error()); while ($row = mysql_fetch_array($result1)) { //Assigning retrieved data from the table into the form $fname = $row[';player_name';]; $sname = $row[';player_surname';]; $cnumber = $row[';player_contact_num';]; $email = $row[';player_email';]; $pos = $row[';player_position';]; $uname = $row[';player_username';]; $pword = $row[';player_password';]; } if (isset($_GET[';player-id';])==$player_id&action==yes) // Check if yes was chosen to definetely delete { $query = "DELETE * FROM playerregistration WHERE player_id = ';$player_id';"; //use player_id to retrieve the player';s information $result = mysql_query($query); $result = mysql_query($query) or die("Query failed: " . mysql_error()); if ($result) { echo "Player deleted successfully."; } else { echo "Failed to delete a player <br>"; } mysql_close($connection); } } //Option[yes or no] to make sure that the user really wants to delete the player echo "Are you sure you want to delete $fname $sname?  <a href=delete.php?player_id=$player_id&action=yes>Yes |</a> <a href=list_players.php>No</a>"; echo "<div align=';center';>"; echo "<form2 method=';post'; >"; echo "<table cellpadding=';5'; bgcolor=';aqua'; border>"; //table to hold the data in the form aligned echo "<td colspan=';2';>    Details of the player to be deleted:</td></tr>"; echo "<input name=';player_id'; type=';hidden'; value=';", $player_id, "';>"; echo "<tr>"; echo "<td>Name: </td>"; echo "<td><input name=';fname'; type=';text'; value=';", $fname, "';></td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Surname: </td>"; echo "<td><input name=';sname'; type=';text'; value=';", $sname, "';></td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Contact number: </td>"; echo "<td><input name=';cnumber'; type=';text'; value=';", $cnumber, "';></td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Email: </td>"; echo "<td><input name=';email'; type=';text'; value=';", $email, "';></td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Position: </td>"; echo "<td><input name=';pos'; type=';text'; value=';", $pos, "';</td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Username: </td>"; echo "<td><input name=';uname'; type=';text'; value=';", $uname, "';></td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Password: </td>"; echo "<td><input name=';pword'; type=';text'; value=';", $pword, "';></td></tr>"; echo "<br />"; echo "</table>"; echo "</form2>"; //end of the form echo "</div>"; ?>
Re: DELETE and EDIT October 16, 2013 08:46AM |
Admin Registered: 11 years ago Posts: 6,606 Rating: 396 |
Re: DELETE and EDIT October 16, 2013 09:22AM |
Admin Registered: 11 years ago Posts: 6,606 Rating: 396 |
Re: DELETE and EDIT October 29, 2013 08:12PM |
Registered: 10 years ago Posts: 16 Rating: 0 |
Language: PHP<?php session_start(); if (!(!(isset($_SESSION[';login';]) && $_SESSION[';login';] != ';';))) { header("Location: login.php"); } echo "<h1 style=';text-align: center';>Losperfontein Football Club</h1>"; echo "<div align=';right';>"; echo "<a href=';list_players.php';>| List Players |</a>"; echo "<a href=';fixtures.php';> List Fixtures |</a>"; echo "<a href=';team_selection.php';> Team selection |</a>"; echo "</div>"; echo "<hr />"; if (isset($_POST[';Submit';])) //Checking if the submit button was clicked { include("connect.php"); if (!$db) //Check connection { echo "Could not connect to the database."; } if (isset($_POST[';player-id';])) { $player_id = $_POST[';player_id';]; $fname = $_POST[';fname';]; $sname = $_POST[';sname';]; $cnumber = $_POST[';cnumber';]; $email = $_POST[';email';]; $pos = $_POST[';pos';]; $uname = $_POST[';uname';]; $pword = $_POST[';pword';]; //Update the table if ($player_id) { $query = "UPDATE playerregistration SET player_name = ';$fname';, player_surname = ';$sname';, player_contact_num = ';$cnumber';, player_email = ';$email';, player_position = ';$pos';, player_username = ';$uname';, player_password = ';$pword'; WHERE player_id = ';$player_id';"; $result = mysql_query($query); if ($result) { echo "Player';s information updated successfully"; //Was the data updated? } else { echo "Failed to update player';s information."; } mysql_close($connection); } } } else { include("connect.php"); if (!$db) //Check connection { echo "Could not connect to the database."; } //Read data from the table and present it in the form $player_id = $_GET[';player_id';];//Get the player_id from URL if ($player_id) { $query1 = "SELECT * FROM playerregistration WHERE player_id = ';$player_id';";//Read a player';s details from table based on player_id from list $result1 = mysql_query($query1) or die("Query failed: " . mysql_error()); if ($result1)//Is data returned from the query? { while ($row = mysql_fetch_array($result1)) { //Assigning retrieved data from the table into the form $fname = $row[';player_name';]; $sname = $row[';player_surname';]; $cnumber = $row[';player_contact_num';]; $email = $row[';player_email';]; $pos = $row[';player_position';]; $uname = $row[';player_username';]; $pword = $row[';player_password';]; } echo "Please update " . $fname . " " . $sname . ';\';s'; . '; '; . "information"; //Inform the user to edit the data in the form if needed } } } //form to display the player';s information to be edited echo "<div align=';center';>"; echo "<form method=';Post';>"; echo "<table cellpadding=';5'; bgcolor=';aqua'; border>"; //table to hold the data in the form aligned echo "<td colspan=';2';>    Player';s details to be edited:</td></tr>"; echo "<input name=';player_id'; type=';hidden'; value=';", $player_id, "';>"; echo "<tr>"; echo "<td>Name: </td>"; echo "<td><input name=';fname'; type=';text'; value=';", $fname, "';></td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Surname: </td>"; echo "<td><input name=';sname'; type=';text'; value=';", $sname, "';></td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Contact number: </td>"; echo "<td><input name=';cnumber'; type=';text'; value=';", $cnumber, "';></td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Email: </td>"; echo "<td><input name=';email'; type=';text'; value=';", $email, "';></td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Position: </td>"; echo "<td><input name=';pos'; type=';text'; value=';", $pos, "';</td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Username: </td>"; echo "<td><input name=';uname'; type=';text'; value=';", $uname, "';></td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Password: </td>"; echo "<td><input name=';pword '; type=';text'; value=';", $pword, "';></td></tr>"; echo "<br />"; echo "<tr >"; echo "<td align=';center'; colspan=';2';><input type=';Submit'; value=';Update';></td></tr>"; echo "</table>"; echo "</form>"; //end of the form echo "</div>"; echo "<hr>"; echo "<div align=';center';>"; echo "Created and maintained by O.B Manoko 4708-271-2"; echo "</div>"; ?>
Re: DELETE and EDIT October 29, 2013 08:33PM |
Admin Registered: 11 years ago Posts: 6,606 Rating: 396 |
Re: DELETE and EDIT October 31, 2013 07:13PM |
Registered: 10 years ago Posts: 16 Rating: 0 |
Re: DELETE and EDIT November 01, 2013 08:05AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |