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 |
Fixtures on one page October 01, 2013 03:29PM |
Registered: 10 years ago Posts: 3 Rating: 0 |
Re: Fixtures on one page October 01, 2013 03:45PM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: Fixtures on one page October 01, 2013 04:10PM |
Registered: 10 years ago Posts: 3 Rating: 0 |
Re: Fixtures on one page October 01, 2013 04:37PM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: Fixtures on one page October 11, 2013 08:37AM |
Registered: 10 years ago Posts: 9 Rating: 0 |
Re: Fixtures on one page October 16, 2013 05:28AM |
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) { $fixture_id = $_GET[';fixture_id';]; $submit = $_POST[';submit';]; $update = $_GET[';no'; || ';yes';]; $delete = $_GET[';yes'; || ';absolutely';]; $query = "SELECT * FROM fixtures"; $result = mysql_query($query); echo "<table border=';1';><tr bgcolor=';#cccccc';><td>Opponents</td><td>Date</td><td>Venue</td><td>Action</td>"; while($row = mysql_fetch_array($result)) { $fixture_id = $row[';fixture_id';]; $opponents = $row[';fixture_opponents';]; $date = $row[';fixture_date';]; $venue = $row[';fixture_venue';]; echo "<tr><td> $opponents </td><td> $date </td><td> $venue </td><td><a href=fixtures.php?fixture_id=$fixture_id>Update</a></td><td><a href=fixtures.php?fixture_id=$fixture_id>Delete</a></td></tr>"; } if ($update==';yes';) { echo "<div align=';center'; action=';fixtures.php';>"; echo "<form method=';post';>"; echo "<table cellpadding=';5'; bgcolor=';aqua'; border>"; //table to hold the data in the form aligned echo "<td colspan=';2';>    Fixture';s details to be edited:</td></tr>"; echo "<input name=';fixture_id'; type=';hidden'; value=';", $fixture_id, "';>"; echo "<tr>"; echo "<td>Opponents: </td>"; echo "<td><input name=';opponents'; type=';text'; value=';", $opponents, "';></td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Date: </td>"; echo "<td><input name=';date'; type=';text'; value=';", $date, "';></td></tr>"; echo "<br />"; echo "<tr>"; echo "<td>Venue: </td>"; echo "<td><input name=';venue'; type=';text'; value=';", $venue, "';></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>"; } elseif ($delete==';yes';) { echo "Are you sure you want to delete $opponents?<a href=';fixtures.php?delete=absolutely&fixture_id=$fixture_id';>Yes</a> <a href=';fixtures.php';>No</a>"; } elseif ($delete==';absolutely';) { $fixture_id = $_GET[';fixture_id';];//Get the fixture_id from URL $query1 = "DELETE * FROM fixtures WHERE fixture_id = ';$fixture_id';";//Delete a fixture';s details from table based on player_id $result1 = mysql_query($query1); if ($result1) { echo "Fixture deleted successfully."; } else { echo "Failed to delete a fixture <br>"; } } elseif ($submit==';update';) { $fixture_id = $_GET[';fixture_id';];//Get the fixture_id from URL //Update the table $query = "UPDATE fixtures SET fixture_opponents = ';opponents';, fixture_date = ';$date';, fixture_venue = ';$venue'; WHERE fixture_id = ';$fixture_id';"; $result = mysql_query($query); if ($result) { echo "Fixture';s information updated successfully"; } else { echo "Failed to update fixture';s information."; } } else { //link to insert new fixture echo "<a href=insert_fix.php>Insert new fixture</a>"; echo "<br><br>"; $query = "SELECT * FROM fixtures"; $result = mysql_query($query); echo "<table border=';1';><tr bgcolor=';#cccccc';><td>Opponents</td><td>Date</td><td>Venue</td><td>Action</td>"; while($row = mysql_fetch_array($result)) { $fixture_id = $row[';fixture_id';]; $opponents = $row[';fixture_opponents';]; $date = $row[';fixture_date';]; $venue = $row[';fixture_venue';]; echo "<tr><td> $opponents </td><td> $date </td><td> $venue </td><td><a href=fixtures.php?fixture_id=$fixture_id>Update</a></td><td><a href=fixtures.php?fixture_id=$fixture_id>Delete</a></td></tr>"; } } } mysql_close($connection);
Re: Fixtures on one page October 16, 2013 08:36AM |
Admin Registered: 11 years ago Posts: 6,606 Rating: 396 |
Language: PHP$update = $_GET[';no'; || ';yes';]; $delete = $_GET[';yes'; || ';absolutely';];
Language: PHPif (isset($_GET[';fixture_id';]) $update = $_GET[';fixture_id';];
The only place where you mention "Update", you set fixture_id, not any yes or no values.Language: PHPecho "<tr><td> $opponents </td><td> $date </td><td> $venue </td><td><a href=fixtures.php?fixture_id=$fixture_id>Update</a></td><td><a href=fixtures.php?fixture_id=$fixture_id>Delete</a></td></tr>";
Language: PHPecho "Are you sure you want to delete $opponents?<a href=';fixtures.php?delete=absolutely&fixture_id=$fixture_id';>Yes</a> <a href=';fixtures.php';>No</a>";
Language: PHPif (isset($_GET[';delete';]) { $delete = $_GET[';delete';]; $fixture_id = $_GET[';fixture_id';]; }
because you do not set a value for the "delete" variable.Language: PHP</a> <a href=';fixtures.php';>No</a>";